xref: /llvm-project/llvm/test/Verifier/sat-intrinsics.ll (revision 926497673e4668880bd78adc9775db2909eaacec)
1; RUN: not opt -S -passes=verify < %s 2>&1 | FileCheck %s
2
3define i32 @sadd_arg_int(float %x, i32 %y) {
4; CHECK: Intrinsic has incorrect argument type!
5  %r = call i32 @llvm.sadd.sat.i32(float %x, i32 %y)
6  ret i32 %r
7}
8
9define i37 @uadd_arg_int(half %x, i37 %y) {
10; CHECK: Intrinsic has incorrect argument type!
11  %r = call i37 @llvm.uadd.sat.i37(i37 %y, half %x)
12  ret i37 %r
13}
14
15define <4 x i32> @ssub_arg_int(<5 x i32> %x, <4 x i32> %y) {
16; CHECK: Intrinsic has incorrect argument type!
17  %r = call <4 x i32> @llvm.ssub.sat.v4i32(<5 x i32> %x, <4 x i32> %y)
18  ret <4 x i32> %r
19}
20
21define <3 x i37> @usub_arg_int(<3 x i37> %x, <3 x i32> %y) {
22; CHECK: Intrinsic has incorrect argument type!
23  %r = call <3 x i37> @llvm.usub.sat.v3i37(<3 x i37> %x, <3 x i32> %y)
24  ret <3 x i37> %r
25}
26
27define float @ushl_return_int(i32 %x, i32 %y) {
28; CHECK: Intrinsic has incorrect return type!
29  %r = call float @llvm.ushl.sat.i32(i32 %x, i32 %y)
30  ret float %r
31}
32
33define <4 x float> @sshl_return_int_vec(<4 x i32> %x, <4 x i32> %y) {
34; CHECK: Intrinsic has incorrect return type!
35  %r = call <4 x float> @llvm.sshl.sat.v4i32(<4 x i32> %x, <4 x i32> %y)
36  ret <4 x float> %r
37}
38
39declare i32 @llvm.sadd.sat.i32(float, i32)
40declare i37 @llvm.uadd.sat.i37(i37, half)
41declare <4 x i32> @llvm.ssub.sat.v4i32(<5 x i32>, <4 x i32>)
42declare <3 x i37> @llvm.usub.sat.v3i37(<3 x i37>, <3 x i32>)
43declare float @llvm.ushl.sat.i32(i32, i32)
44declare <4 x float> @llvm.sshl.sat.v4i32(<4 x i32>, <4 x i32>)
45