Debian Codegraph @

llvm/test/CodeGen/SPIRV/extensions/SPV_ALTERA_arbitrary_precision_integers/i128-addsub.ll

raw
1 ; RUN: not llc -O0 -mtriple=spirv64-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
2
3 ; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_ALTERA_arbitrary_precision_integers %s -o - | FileCheck %s
4 ; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_ALTERA_arbitrary_precision_integers %s -o - -filetype=obj | spirv-val %}
5
6 ; CHECK-ERROR: LLVM ERROR: OpTypeInt type with a width other than 8, 16, 32 or 64 bits requires the following SPIR-V extension: SPV_ALTERA_arbitrary_precision_integers
7
8 ; CHECK: OpCapability ArbitraryPrecisionIntegersALTERA
9 ; CHECK: OpExtension "SPV_ALTERA_arbitrary_precision_integers"
10 ; CHECK: OpName %[[#TestAdd:]] "test_add"
11 ; CHECK: OpName %[[#TestSub:]] "test_sub"
12 ; CHECK: %[[#Int128Ty:]] = OpTypeInt 128 0
13 ; CHECK: %[[#Const64Int128:]] = OpConstant %[[#Int128Ty]] 64 0 0 0
14
15 ; CHECK: %[[#TestAdd]] = OpFunction
16 define spir_func void @test_add(i64 %AL, i64 %AH, i64 %BL, i64 %BH, ptr %RL, ptr %RH) {
17 entry:
18 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
19 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
20 ; CHECK: {{.*}} = OpShiftLeftLogical %[[#Int128Ty]] {{%[0-9]+}} %[[#Const64Int128]]
21 ; CHECK: {{.*}} = OpBitwiseOr %[[#Int128Ty]]
22 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
23 ; CHECK: {{.*}} = OpIAdd %[[#Int128Ty]]
24 %tmp1 = zext i64 %AL to i128
25 %tmp23 = zext i64 %AH to i128
26 %tmp4 = shl i128 %tmp23, 64
27 %tmp5 = or i128 %tmp4, %tmp1
28 %tmp67 = zext i64 %BL to i128
29 %tmp89 = zext i64 %BH to i128
30 %tmp11 = shl i128 %tmp89, 64
31 %tmp12 = or i128 %tmp11, %tmp67
32 %tmp15 = add i128 %tmp12, %tmp5
33 %tmp1617 = trunc i128 %tmp15 to i64
34 store i64 %tmp1617, ptr %RL
35 %tmp21 = lshr i128 %tmp15, 64
36 %tmp2122 = trunc i128 %tmp21 to i64
37 store i64 %tmp2122, ptr %RH
38 ret void
39 ; CHECK: OpFunctionEnd
40 }
41
42 ; CHECK: %[[#TestSub]] = OpFunction
43 define spir_func void @test_sub(i64 %AL, i64 %AH, i64 %BL, i64 %BH, ptr %RL, ptr %RH) {
44 entry:
45 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
46 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
47 ; CHECK: {{.*}} = OpShiftLeftLogical %[[#Int128Ty]] {{%[0-9]+}} %[[#Const64Int128]]
48 ; CHECK: {{.*}} = OpBitwiseOr %[[#Int128Ty]]
49 ; CHECK: {{.*}} = OpUConvert %[[#Int128Ty]]
50 ; CHECK: {{.*}} = OpISub %[[#Int128Ty]]
51 %tmp1 = zext i64 %AL to i128
52 %tmp23 = zext i64 %AH to i128
53 %tmp4 = shl i128 %tmp23, 64
54 %tmp5 = or i128 %tmp4, %tmp1
55 %tmp67 = zext i64 %BL to i128
56 %tmp89 = zext i64 %BH to i128
57 %tmp11 = shl i128 %tmp89, 64
58 %tmp12 = or i128 %tmp11, %tmp67
59 %tmp15 = sub i128 %tmp5, %tmp12
60 %tmp1617 = trunc i128 %tmp15 to i64
61 store i64 %tmp1617, ptr %RL
62 %tmp21 = lshr i128 %tmp15, 64
63 %tmp2122 = trunc i128 %tmp21 to i64
64 store i64 %tmp2122, ptr %RH
65 ret void
66 ; CHECK: OpFunctionEnd
67 }