summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/sat-arith.ll
blob: 4844ed1bd21e253e042073434784ff2c1b4ac763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; 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-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-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
}

; upper-bound of the immediate argument
; CHECK-LABEL: ssat1
define i32 @ssat1() nounwind {
; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #32, [[R0]]
  %tmp = call i32 @llvm.arm.ssat(i32 128, i32 32)
  ret i32 %tmp
}

; lower-bound of the immediate argument
; CHECK-LABEL: ssat2
define i32 @ssat2() nounwind {
; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #1, [[R0]]
  %tmp = call i32 @llvm.arm.ssat(i32 128, i32 1)
  ret i32 %tmp
}

; upper-bound of the immediate argument
; CHECK-LABEL: usat1
define i32 @usat1() nounwind {
; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #31, [[R0]]
  %tmp = call i32 @llvm.arm.usat(i32 128, i32 31)
  ret i32 %tmp
}

; lower-bound of the immediate argument
; CHECK-LABEL: usat2
define i32 @usat2() nounwind {
; CHECK: mov{{s?}} [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #0, [[R0]]
  %tmp = call i32 @llvm.arm.usat(i32 128, i32 0)
  ret i32 %tmp
}

declare i32 @llvm.arm.qadd(i32, i32) nounwind
declare i32 @llvm.arm.qsub(i32, i32) nounwind
declare i32 @llvm.arm.ssat(i32, i32) nounwind readnone
declare i32 @llvm.arm.usat(i32, i32) nounwind readnone
OpenPOWER on IntegriCloud