]> granicus.if.org Git - clang/commitdiff
[PowerPC] Support constraint code "ww"
authorFangrui Song <maskray@google.com>
Thu, 4 Jul 2019 04:44:42 +0000 (04:44 +0000)
committerFangrui Song <maskray@google.com>
Thu, 4 Jul 2019 04:44:42 +0000 (04:44 +0000)
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

lib/Basic/Targets/PPC.h
test/CodeGen/ppc64-inline-asm.c

index 465a7cf422138283cfdda5913485041595c50314..6c132e3841ff54082b233502ae2be9fab8af06e7 100644 (file)
@@ -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
index 552fe280e0005086f1fc78d3f137f7200c628f7b..3e958c328f929fbca76b0302b026a585f64dc610 100644 (file)
@@ -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)
+}