Guard fabs to bfc convert with V6T2 flag
[oota-llvm.git] / test / CodeGen / ARM / sat-arith.ll
1 ; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s -check-prefix=ARM -check-prefix=CHECK
2 ; RUN: llc -O1 -mtriple=thumbv7-none-none-eabi %s -o - | FileCheck %s -check-prefix=THUMB -check-prefix=CHECK
3
4 ; CHECK-LABEL: qadd
5 define i32 @qadd() nounwind {
6 ; CHECK-DAG: mov{{s?}} [[R0:.*]], #8
7 ; CHECK-DAG: mov{{s?}} [[R1:.*]], #128
8 ; CHECK-ARM: qadd [[R0]], [[R1]], [[R0]]
9 ; CHECK-THRUMB: qadd [[R0]], [[R0]], [[R1]]
10   %tmp = call i32 @llvm.arm.qadd(i32 128, i32 8)
11   ret i32 %tmp
12 }
13
14 ; CHECK-LABEL: qsub
15 define i32 @qsub() nounwind {
16 ; CHECK-DAG: mov{{s?}} [[R0:.*]], #8
17 ; CHECK-DAG: mov{{s?}} [[R1:.*]], #128
18 ; CHECK-ARM: qsub [[R0]], [[R1]], [[R0]]
19 ; CHECK-THRUMB: qadd [[R0]], [[R1]], [[R0]]
20   %tmp = call i32 @llvm.arm.qsub(i32 128, i32 8)
21   ret i32 %tmp
22 }
23
24 ; upper-bound of the immediate argument
25 ; CHECK-LABEL: ssat1
26 define i32 @ssat1() nounwind {
27 ; CHECK: mov{{s?}} [[R0:.*]], #128
28 ; CHECK: ssat [[R1:.*]], #32, [[R0]]
29   %tmp = call i32 @llvm.arm.ssat(i32 128, i32 32)
30   ret i32 %tmp
31 }
32
33 ; lower-bound of the immediate argument
34 ; CHECK-LABEL: ssat2
35 define i32 @ssat2() nounwind {
36 ; CHECK: mov{{s?}} [[R0:.*]], #128
37 ; CHECK: ssat [[R1:.*]], #1, [[R0]]
38   %tmp = call i32 @llvm.arm.ssat(i32 128, i32 1)
39   ret i32 %tmp
40 }
41
42 ; upper-bound of the immediate argument
43 ; CHECK-LABEL: usat1
44 define i32 @usat1() nounwind {
45 ; CHECK: mov{{s?}} [[R0:.*]], #128
46 ; CHECK: usat [[R1:.*]], #31, [[R0]]
47   %tmp = call i32 @llvm.arm.usat(i32 128, i32 31)
48   ret i32 %tmp
49 }
50
51 ; lower-bound of the immediate argument
52 ; CHECK-LABEL: usat2
53 define i32 @usat2() nounwind {
54 ; CHECK: mov{{s?}} [[R0:.*]], #128
55 ; CHECK: usat [[R1:.*]], #0, [[R0]]
56   %tmp = call i32 @llvm.arm.usat(i32 128, i32 0)
57   ret i32 %tmp
58 }
59
60 declare i32 @llvm.arm.qadd(i32, i32) nounwind
61 declare i32 @llvm.arm.qsub(i32, i32) nounwind
62 declare i32 @llvm.arm.ssat(i32, i32) nounwind readnone
63 declare i32 @llvm.arm.usat(i32, i32) nounwind readnone