[llvm] r256115 - Fix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions for Thumb2
Weiming Zhao via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 19 22:41:45 PST 2015
Author: weimingz
Date: Sun Dec 20 00:41:44 2015
New Revision: 256115
URL: http://llvm.org/viewvc/llvm-project?rev=256115&view=rev
Log:
Fix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions for Thumb2
Summary:
r250697 fixed the mapping for ARM mode. We have to do the same for Thumb2 otherwise the same llvm.arm.ssat() will generate different saturating amount for ARM and Thumb.
r250697: http://reviews.llvm.org/rL250697
Reviewers: rmaprath
Subscribers: aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D15653
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
llvm/trunk/test/CodeGen/ARM/sat-arith.ll
llvm/trunk/test/CodeGen/ARM/ssat-lower.ll
llvm/trunk/test/CodeGen/ARM/ssat-upper.ll
llvm/trunk/test/CodeGen/ARM/usat-lower.ll
llvm/trunk/test/CodeGen/ARM/usat-upper.ll
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Sun Dec 20 00:41:44 2015
@@ -2291,8 +2291,8 @@ def t2USAT16: T2SatI<(outs rGPR:$Rd), (i
let Inst{5-4} = 0b00;
}
-def : T2Pat<(int_arm_ssat GPR:$a, imm:$pos), (t2SSAT imm:$pos, GPR:$a, 0)>;
-def : T2Pat<(int_arm_usat GPR:$a, imm:$pos), (t2USAT imm:$pos, GPR:$a, 0)>;
+def : T2Pat<(int_arm_ssat GPR:$a, imm1_32:$pos), (t2SSAT imm1_32:$pos, GPR:$a, 0)>;
+def : T2Pat<(int_arm_usat GPR:$a, imm0_31:$pos), (t2USAT imm0_31:$pos, GPR:$a, 0)>;
//===----------------------------------------------------------------------===//
// Shift and rotate Instructions.
Modified: llvm/trunk/test/CodeGen/ARM/sat-arith.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/sat-arith.ll?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/sat-arith.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/sat-arith.ll Sun Dec 20 00:41:44 2015
@@ -1,19 +1,22 @@
-; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s
+; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s -check-prefix=ARM -check-prefix=CHECK
+; RUN: llc -O1 -mtriple=thumbv7-none-none-eabi %s -o - | FileCheck %s -check-prefix=THUMB -check-prefix=CHECK
; CHECK-LABEL: qadd
define i32 @qadd() nounwind {
-; CHECK: mov [[R0:.*]], #8
-; CHECK: mov [[R1:.*]], #128
-; CHECK: qadd [[R0]], [[R1]], [[R0]]
+; CHECK-DAG: mov{{s?}} [[R0:.*]], #8
+; CHECK-DAG: mov{{s?}} [[R1:.*]], #128
+; CHECK-ARM: qadd [[R0]], [[R1]], [[R0]]
+; CHECK-THRUMB: qadd [[R0]], [[R0]], [[R1]]
%tmp = call i32 @llvm.arm.qadd(i32 128, i32 8)
ret i32 %tmp
}
; CHECK-LABEL: qsub
define i32 @qsub() nounwind {
-; CHECK: mov [[R0:.*]], #8
-; CHECK: mov [[R1:.*]], #128
-; CHECK: qsub [[R0]], [[R1]], [[R0]]
+; CHECK-DAG: mov{{s?}} [[R0:.*]], #8
+; CHECK-DAG: mov{{s?}} [[R1:.*]], #128
+; CHECK-ARM: qsub [[R0]], [[R1]], [[R0]]
+; CHECK-THRUMB: qadd [[R0]], [[R1]], [[R0]]
%tmp = call i32 @llvm.arm.qsub(i32 128, i32 8)
ret i32 %tmp
}
@@ -21,7 +24,7 @@ define i32 @qsub() nounwind {
; upper-bound of the immediate argument
; CHECK-LABEL: ssat1
define i32 @ssat1() nounwind {
-; CHECK: mov [[R0:.*]], #128
+; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #32, [[R0]]
%tmp = call i32 @llvm.arm.ssat(i32 128, i32 32)
ret i32 %tmp
@@ -30,7 +33,7 @@ define i32 @ssat1() nounwind {
; lower-bound of the immediate argument
; CHECK-LABEL: ssat2
define i32 @ssat2() nounwind {
-; CHECK: mov [[R0:.*]], #128
+; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #1, [[R0]]
%tmp = call i32 @llvm.arm.ssat(i32 128, i32 1)
ret i32 %tmp
@@ -39,7 +42,7 @@ define i32 @ssat2() nounwind {
; upper-bound of the immediate argument
; CHECK-LABEL: usat1
define i32 @usat1() nounwind {
-; CHECK: mov [[R0:.*]], #128
+; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #31, [[R0]]
%tmp = call i32 @llvm.arm.usat(i32 128, i32 31)
ret i32 %tmp
@@ -48,7 +51,7 @@ define i32 @usat1() nounwind {
; lower-bound of the immediate argument
; CHECK-LABEL: usat2
define i32 @usat2() nounwind {
-; CHECK: mov [[R0:.*]], #128
+; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #0, [[R0]]
%tmp = call i32 @llvm.arm.usat(i32 128, i32 0)
ret i32 %tmp
Modified: llvm/trunk/test/CodeGen/ARM/ssat-lower.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ssat-lower.ll?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ssat-lower.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ssat-lower.ll Sun Dec 20 00:41:44 2015
@@ -1,4 +1,5 @@
; RUN: not llc < %s -O1 -mtriple=armv6-none-none-eabi 2>&1 | FileCheck %s
+; RUN: not llc < %s -O1 -mtriple=thumbv7-none-none-eabi 2>&1 | FileCheck %s
; immediate argument < lower-bound
; CHECK: LLVM ERROR: Cannot select: intrinsic %llvm.arm.ssat
Modified: llvm/trunk/test/CodeGen/ARM/ssat-upper.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ssat-upper.ll?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ssat-upper.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ssat-upper.ll Sun Dec 20 00:41:44 2015
@@ -1,4 +1,5 @@
; RUN: not llc < %s -O1 -mtriple=armv6-none-none-eabi 2>&1 | FileCheck %s
+; RUN: not llc < %s -O1 -mtriple=thumbv7-none-none-eabi 2>&1 | FileCheck %s
; immediate argument > upper-bound
; CHECK: LLVM ERROR: Cannot select: intrinsic %llvm.arm.ssat
Modified: llvm/trunk/test/CodeGen/ARM/usat-lower.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/usat-lower.ll?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/usat-lower.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/usat-lower.ll Sun Dec 20 00:41:44 2015
@@ -1,4 +1,5 @@
; RUN: not llc < %s -O1 -mtriple=armv6-none-none-eabi 2>&1 | FileCheck %s
+; RUN: not llc < %s -O1 -mtriple=thumbv7-none-none-eabi 2>&1 | FileCheck %s
; immediate argument < lower-bound
; CHECK: LLVM ERROR: Cannot select: intrinsic %llvm.arm.usat
Modified: llvm/trunk/test/CodeGen/ARM/usat-upper.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/usat-upper.ll?rev=256115&r1=256114&r2=256115&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/usat-upper.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/usat-upper.ll Sun Dec 20 00:41:44 2015
@@ -1,4 +1,5 @@
; RUN: not llc < %s -O1 -mtriple=armv6-none-none-eabi 2>&1 | FileCheck %s
+; RUN: not llc < %s -O1 -mtriple=thumbv7-none-none-eabi 2>&1 | FileCheck %s
; immediate argument > upper-bound
; CHECK: LLVM ERROR: Cannot select: intrinsic %llvm.arm.usat
More information about the llvm-commits
mailing list