From: Fangrui Song Date: Thu, 4 Jul 2019 04:44:42 +0000 (+0000) Subject: [PowerPC] Support constraint code "ww" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72bc0858a61b5f739f9e75026aa8c839a1301ed3;p=clang [PowerPC] Support constraint code "ww" Summary: "ww" and "ws" are both constraint codes for VSX vector registers that hold scalar double data. "ww" is preferred for float while "ws" is preferred for double. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D64119 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365106 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h index 465a7cf422..6c132e3841 100644 --- a/lib/Basic/Targets/PPC.h +++ b/lib/Basic/Targets/PPC.h @@ -207,7 +207,8 @@ public: switch (Name[1]) { case 'd': // VSX vector register to hold vector double data case 'f': // VSX vector register to hold vector float data - case 's': // VSX vector register to hold scalar float data + case 's': // VSX vector register to hold scalar double data + case 'w': // VSX vector register to hold scalar double data case 'a': // Any VSX register case 'c': // An individual CR bit case 'i': // FP or VSX register to hold 64-bit integers data diff --git a/test/CodeGen/ppc64-inline-asm.c b/test/CodeGen/ppc64-inline-asm.c index 552fe280e0..3e958c328f 100644 --- a/test/CodeGen/ppc64-inline-asm.c +++ b/test/CodeGen/ppc64-inline-asm.c @@ -24,3 +24,16 @@ unsigned char test_wc_i8(unsigned char b1, unsigned char b2) { // CHECK: call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i8 %b1, i8 %b2) } +float test_fmaxf(float x, float y) { + asm("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y)); + return x; +// CHECK-LABEL: float @test_fmaxf(float %x, float %y) +// CHECK: call float asm "xsmaxdp ${0:x}, ${1:x}, ${2:x}", "=^ww,^ww,^ww"(float %x, float %y) +} + +double test_fmax(double x, double y) { + asm("xsmaxdp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y)); + return x; +// CHECK-LABEL: double @test_fmax(double %x, double %y) +// CHECK: call double asm "xsmaxdp ${0:x}, ${1:x}, ${2:x}", "=^ws,^ws,^ws"(double %x, double %y) +}