1 ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
3 declare void @llvm.test.immarg.intrinsic.i32(i32 immarg)
4 declare void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> immarg)
5 declare void @llvm.test.immarg.intrinsic.f32(float immarg)
6 declare void @llvm.test.immarg.intrinsic.v2f32(<2 x float> immarg)
7 declare void @llvm.test.immarg.intrinsic.2ai32([2 x i32] immarg)
9 @gv = global i32 undef, align 4
11 define void @call_llvm.test.immarg.intrinsic.i32(i32 %arg) {
12 ; CHECK: immarg operand has non-immediate parameter
13 ; CHECK-NEXT: i32 undef
14 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.i32(i32 undef)
15 call void @llvm.test.immarg.intrinsic.i32(i32 undef)
17 ; CHECK: immarg operand has non-immediate parameter
18 ; CHECK-NEXT: i32 %arg
19 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.i32(i32 %arg)
20 call void @llvm.test.immarg.intrinsic.i32(i32 %arg)
22 ; CHECK: immarg operand has non-immediate parameter
23 ; CHECK-NEXT: i32 ptrtoint (i32* @gv to i32)
24 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.i32(i32 ptrtoint (i32* @gv to i32))
25 call void @llvm.test.immarg.intrinsic.i32(i32 ptrtoint (i32* @gv to i32))
29 define void @call_llvm.test.immarg.intrinsic.f32() {
30 ; CHECK: immarg operand has non-immediate parameter
31 ; CHECK-NEXT: float undef
32 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.f32(float undef)
33 call void @llvm.test.immarg.intrinsic.f32(float undef)
37 define void @call_llvm.test.immarg.intrinsic.v2i32() {
38 ; CHECK: immarg operand has non-immediate parameter
39 ; CHECK-NEXT: <2 x i32> zeroinitializer
40 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> zeroinitializer)
41 call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> zeroinitializer)
43 ; CHECK: immarg operand has non-immediate parameter
44 ; CHECK-NEXT: <2 x i32> <i32 1, i32 2>
45 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> <i32 1, i32 2>)
46 call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> <i32 1, i32 2>)
48 ; CHECK: immarg operand has non-immediate parameter
49 ; CHECK-NEXT: <2 x i32> undef
50 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> undef)
51 call void @llvm.test.immarg.intrinsic.v2i32(<2 x i32> undef)
55 define void @call_llvm.test.immarg.intrinsic.v2f32() {
56 ; CHECK: immarg operand has non-immediate parameter
57 ; CHECK-NEXT: <2 x float> zeroinitializer
58 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.v2f32(<2 x float> zeroinitializer)
59 call void @llvm.test.immarg.intrinsic.v2f32(<2 x float> zeroinitializer)
61 ; CHECK: immarg operand has non-immediate parameter
62 ; CHECK-NEXT: <2 x float> <float 1.000000e+00, float 2.000000e+00>
63 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.v2f32(<2 x float> <float 1.000000e+00, float 2.000000e+00>)
64 call void @llvm.test.immarg.intrinsic.v2f32(<2 x float> <float 1.0, float 2.0>)
68 define void @call_llvm.test.immarg.intrinsic.2ai32() {
69 ; CHECK: immarg operand has non-immediate parameter
70 ; CHECK-NEXT: [2 x i32] zeroinitializer
71 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.2ai32([2 x i32] zeroinitializer)
72 call void @llvm.test.immarg.intrinsic.2ai32([2 x i32] zeroinitializer)
74 ; CHECK: immarg operand has non-immediate parameter
75 ; CHECK-NEXT: [2 x i32] [i32 1, i32 2]
76 ; CHECK-NEXT: call void @llvm.test.immarg.intrinsic.2ai32([2 x i32] [i32 1, i32 2])
77 call void @llvm.test.immarg.intrinsic.2ai32([2 x i32] [i32 1, i32 2])
81 ; CHECK: immarg attribute only applies to intrinsics
82 ; CHECK-NEXT: void (i32)* @not_an_intrinsic
83 declare void @not_an_intrinsic(i32 immarg)
85 declare void @llvm.test.intrinsic(i32)
86 declare void @func(i32)
88 define void @only_on_callsite() {
89 ; CHECK: immarg attribute only applies to intrinsics
90 ; CHECK-NEXT: call void @func(i32 immarg 0)
91 ; CHECK-NEXT: immarg may not apply only to call sites
93 ; CHECK-NEXT: call void @func(i32 immarg 0)
94 call void @func(i32 immarg 0)
96 ; CHECK: immarg may not apply only to call sites
98 ; CHECK-NEXT: call void @llvm.test.intrinsic(i32 immarg 0)
99 call void @llvm.test.intrinsic(i32 immarg 0)
103 ; CHECK: immarg attribute only applies to intrinsics
104 ; CHECK: void (i32)* @on_function_definition
105 define void @on_function_definition(i32 immarg %arg) {