inlineasm.ll
2.67 KB
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
64
65
66
67
68
69
70
71
72
73
74
; RUN: llc -mtriple=armv8-eabi -mattr=+neon %s -o - | FileCheck %s
define i32 @test1(i32 %tmp54) {
%tmp56 = tail call i32 asm "uxtb16 $0,$1", "=r,r"( i32 %tmp54 ) ; <i32> [#uses=1]
ret i32 %tmp56
}
define void @test2() {
tail call void asm sideeffect "/* number: ${0:c} */", "i"( i32 1 )
ret void
}
define float @t-constraint-int(i32 %i) {
; CHECK-LABEL: t-constraint-int
; CHECK: vcvt.f32.s32 {{s[0-9]+}}, {{s[0-9]+}}
%ret = call float asm "vcvt.f32.s32 $0, $1\0A", "=t,t"(i32 %i)
ret float %ret
}
define <2 x i32> @t-constraint-int-vector-64bit(<2 x float> %x) {
entry:
; CHECK-LABEL: t-constraint-int-vector-64bit
; CHECK: vcvt.s32.f32 {{d[0-9]+}}, {{d[0-9]+}}
%0 = tail call <2 x i32> asm "vcvt.s32.f32 $0, $1", "=t,t"(<2 x float> %x)
ret <2 x i32> %0
}
define <4 x i32> @t-constraint-int-vector-128bit(<4 x float> %x) {
entry:
; CHECK-LABEL: t-constraint-int-vector-128bit
; CHECK: vcvt.s32.f32 {{q[0-7]}}, {{q[0-7]}}
%0 = tail call <4 x i32> asm "vcvt.s32.f32 $0, $1", "=t,t"(<4 x float> %x)
ret <4 x i32> %0
}
define <2 x float> @t-constraint-float-vector-64bit(<2 x float> %a, <2 x float> %b) {
entry:
; CHECK-LABEL: t-constraint-float-vector-64bit
; CHECK: vadd.f32 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
%0 = tail call <2 x float> asm "vadd.f32 $0, $1, $2", "=t,t,t"(<2 x float> %a, <2 x float> %b)
ret <2 x float> %0
}
define <4 x float> @t-constraint-float-vector-128bit(<4 x float> %a, <4 x float> %b) {
entry:
; CHECK-LABEL: t-constraint-float-vector-128bit
; CHECK: vadd.f32 q{{[0-7]}}, q{{[0-7]}}, q{{[0-7]}}
%0 = tail call <4 x float> asm "vadd.f32 $0, $1, $2", "=t,t,t"(<4 x float> %a, <4 x float> %b)
ret <4 x float> %0
}
define i32 @even-GPR-constraint() {
entry:
; CHECK-LABEL: even-GPR-constraint
; CHECK: add [[REG:r1*[0, 2, 4, 6, 8]]], [[REG]], #1
; CHECK: add [[REG:r1*[0, 2, 4, 6, 8]]], [[REG]], #2
; CHECK: add [[REG:r1*[0, 2, 4, 6, 8]]], [[REG]], #3
; CHECK: add [[REG:r1*[0, 2, 4, 6, 8]]], [[REG]], #4
%0 = tail call { i32, i32, i32, i32 } asm "add $0, #1\0Aadd $1, #2\0Aadd $2, #3\0Aadd $3, #4\0A", "=^Te,=^Te,=^Te,=^Te,0,1,2,3"(i32 0, i32 0, i32 0, i32 0)
%asmresult = extractvalue { i32, i32, i32, i32 } %0, 0
ret i32 %asmresult
}
define i32 @odd-GPR-constraint() {
entry:
; CHECK-LABEL: odd-GPR-constraint
; CHECK: add [[REG:r1*[1, 3, 5, 7, 9]]], [[REG]], #1
; CHECK: add [[REG:r1*[1, 3, 5, 7, 9]]], [[REG]], #2
; CHECK: add [[REG:r1*[1, 3, 5, 7, 9]]], [[REG]], #3
; CHECK: add [[REG:r1*[1, 3, 5, 7, 9]]], [[REG]], #4
%0 = tail call { i32, i32, i32, i32 } asm "add $0, #1\0Aadd $1, #2\0Aadd $2, #3\0Aadd $3, #4\0A", "=^To,=^To,=^To,=^To,0,1,2,3"(i32 0, i32 0, i32 0, i32 0)
%asmresult = extractvalue { i32, i32, i32, i32 } %0, 0
ret i32 %asmresult
}