Debian Codegraph @

llvm/test/Transforms/ConstantHoisting/X86/large-immediate.ll

raw
1 ; RUN: opt -mtriple=x86_64-darwin-unknown -S -passes=consthoist < %s | FileCheck %s
2
3 define i128 @test1(i128 %a) nounwind {
4 ; CHECK-LABEL: test1
5 ; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
6 %1 = add i128 %a, 12297829382473034410122878
7 %2 = add i128 %1, 12297829382473034410122878
8 ret i128 %2
9 }
10
11 ; Check that we don't hoist the shift value of a shift instruction.
12 define i512 @test2(i512 %a) nounwind {
13 ; CHECK-LABEL: test2
14 ; CHECK-NOT: %const = bitcast i512 504 to i512
15 %1 = shl i512 %a, 504
16 %2 = ashr i512 %1, 504
17 ret i512 %2
18 }
19
20 ; Check that we don't hoist constants with a type larger than i128.
21 define i196 @test3(i196 %a) nounwind {
22 ; CHECK-LABEL: test3
23 ; CHECK-NOT: %const = bitcast i196 2 to i196
24 %1 = mul i196 %a, 2
25 %2 = mul i196 %1, 2
26 ret i196 %2
27 }
28
29 ; Check that we don't hoist immediates with small values.
30 define i96 @test4(i96 %a) nounwind {
31 ; CHECK-LABEL: test4
32 ; CHECK-NOT: %const = bitcast i96 2 to i96
33 %1 = mul i96 %a, 2
34 %2 = add i96 %1, 2
35 ret i96 %2
36 }