[llvm] r269922 - [SystemZ] Fix register ordering for BinaryRRF instructions

Bryan Chan via llvm-commits llvm-commits at lists.llvm.org
Wed May 18 06:24:57 PDT 2016


Author: bryanpkc
Date: Wed May 18 08:24:57 2016
New Revision: 269922

URL: http://llvm.org/viewvc/llvm-project?rev=269922&view=rev
Log:
[SystemZ] Fix register ordering for BinaryRRF instructions

Summary:
The ordering of registers in BinaryRRF instructions are wrong, and
affects the copysign instruction (CPSDR). This results in the wrong
magnitude and sign being set.

Author: zhanjunl

Reviewers: kbarton, uweigand

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20308


Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td
    llvm/trunk/test/CodeGen/SystemZ/fp-copysign-01.ll

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td?rev=269922&r1=269921&r2=269922&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td Wed May 18 08:24:57 2016
@@ -1439,9 +1439,9 @@ class BinaryRRE<string mnemonic, bits<16
 
 class BinaryRRF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
                 RegisterOperand cls1, RegisterOperand cls2>
-  : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R3, cls2:$R2),
+  : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R2, cls2:$R3),
             mnemonic#"r\t$R1, $R3, $R2",
-            [(set cls1:$R1, (operator cls1:$R3, cls2:$R2))]> {
+            [(set cls1:$R1, (operator cls1:$R2, cls2:$R3))]> {
   let OpKey = mnemonic ## cls1;
   let OpType = "reg";
   let R4 = 0;

Modified: llvm/trunk/test/CodeGen/SystemZ/fp-copysign-01.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/fp-copysign-01.ll?rev=269922&r1=269921&r2=269922&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/fp-copysign-01.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/fp-copysign-01.ll Wed May 18 08:24:57 2016
@@ -11,7 +11,7 @@ declare fp128 @copysignl(fp128, fp128) r
 define float @f1(float %a, float %b) {
 ; CHECK-LABEL: f1:
 ; CHECK-NOT: %f2
-; CHECK: cpsdr %f0, %f0, %f2
+; CHECK: cpsdr %f0, %f2, %f0
 ; CHECK: br %r14
   %res = call float @copysignf(float %a, float %b) readnone
   ret float %res
@@ -21,7 +21,7 @@ define float @f1(float %a, float %b) {
 define float @f2(float %a, double %bd) {
 ; CHECK-LABEL: f2:
 ; CHECK-NOT: %f2
-; CHECK: cpsdr %f0, %f0, %f2
+; CHECK: cpsdr %f0, %f2, %f0
 ; CHECK: br %r14
   %b = fptrunc double %bd to float
   %res = call float @copysignf(float %a, float %b) readnone
@@ -33,7 +33,7 @@ define float @f3(float %a, fp128 *%bptr)
 ; CHECK-LABEL: f3:
 ; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r2)
 ; CHECK: ld [[BLOW:%f[0-7]]], 8(%r2)
-; CHECK: cpsdr %f0, %f0, [[BHIGH]]
+; CHECK: cpsdr %f0, [[BHIGH]], %f0
 ; CHECK: br %r14
   %bl = load volatile fp128 , fp128 *%bptr
   %b = fptrunc fp128 %bl to float
@@ -45,7 +45,7 @@ define float @f3(float %a, fp128 *%bptr)
 define double @f4(double %a, float %bf) {
 ; CHECK-LABEL: f4:
 ; CHECK-NOT: %f2
-; CHECK: cpsdr %f0, %f0, %f2
+; CHECK: cpsdr %f0, %f2, %f0
 ; CHECK: br %r14
   %b = fpext float %bf to double
   %res = call double @copysign(double %a, double %b) readnone
@@ -56,7 +56,7 @@ define double @f4(double %a, float %bf)
 define double @f5(double %a, double %b) {
 ; CHECK-LABEL: f5:
 ; CHECK-NOT: %f2
-; CHECK: cpsdr %f0, %f0, %f2
+; CHECK: cpsdr %f0, %f2, %f0
 ; CHECK: br %r14
   %res = call double @copysign(double %a, double %b) readnone
   ret double %res
@@ -67,7 +67,7 @@ define double @f6(double %a, fp128 *%bpt
 ; CHECK-LABEL: f6:
 ; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r2)
 ; CHECK: ld [[BLOW:%f[0-7]]], 8(%r2)
-; CHECK: cpsdr %f0, %f0, [[BHIGH]]
+; CHECK: cpsdr %f0, [[BHIGH]], %f0
 ; CHECK: br %r14
   %bl = load volatile fp128 , fp128 *%bptr
   %b = fptrunc fp128 %bl to double
@@ -82,7 +82,7 @@ define void @f7(fp128 *%cptr, fp128 *%ap
 ; CHECK-LABEL: f7:
 ; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3)
 ; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3)
-; CHECK: cpsdr [[AHIGH]], [[AHIGH]], %f0
+; CHECK: cpsdr [[AHIGH]], %f0, [[AHIGH]]
 ; CHECK: std [[AHIGH]], 0(%r2)
 ; CHECK: std [[ALOW]], 8(%r2)
 ; CHECK: br %r14
@@ -98,7 +98,7 @@ define void @f8(fp128 *%cptr, fp128 *%ap
 ; CHECK-LABEL: f8:
 ; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3)
 ; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3)
-; CHECK: cpsdr [[AHIGH]], [[AHIGH]], %f0
+; CHECK: cpsdr [[AHIGH]], %f0, [[AHIGH]]
 ; CHECK: std [[AHIGH]], 0(%r2)
 ; CHECK: std [[ALOW]], 8(%r2)
 ; CHECK: br %r14
@@ -116,7 +116,7 @@ define void @f9(fp128 *%cptr, fp128 *%ap
 ; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3)
 ; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3)
 ; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r4)
-; CHECK: cpsdr [[AHIGH]], [[AHIGH]], [[BHIGH]]
+; CHECK: cpsdr [[AHIGH]], [[BHIGH]], [[AHIGH]]
 ; CHECK: std [[AHIGH]], 0(%r2)
 ; CHECK: std [[ALOW]], 8(%r2)
 ; CHECK: br %r14




More information about the llvm-commits mailing list