r365106 - [PowerPC] Support constraint code "ww"

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 21:44:42 PDT 2019


Author: maskray
Date: Wed Jul  3 21:44:42 2019
New Revision: 365106

URL: http://llvm.org/viewvc/llvm-project?rev=365106&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/Basic/Targets/PPC.h
    cfe/trunk/test/CodeGen/ppc64-inline-asm.c

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=365106&r1=365105&r2=365106&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Wed Jul  3 21:44:42 2019
@@ -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

Modified: cfe/trunk/test/CodeGen/ppc64-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc64-inline-asm.c?rev=365106&r1=365105&r2=365106&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ppc64-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ppc64-inline-asm.c Wed Jul  3 21:44:42 2019
@@ -24,3 +24,16 @@ unsigned char test_wc_i8(unsigned char b
 // 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)
+}




More information about the cfe-commits mailing list