1; RUN: opt -mtriple=arm64-darwin-unknown -S -consthoist < %s | FileCheck %s
2
3define 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 large, but cheap constants
12define i512 @test2(i512 %a) nounwind {
13; CHECK-LABEL: test2
14; CHECK-NOT: %const = bitcast i512 7 to i512
15  %1 = and i512 %a, 7
16  %2 = or i512 %1, 7
17  ret i512 %2
18}
19
20; Check that we don't hoist the shift value of a shift instruction.
21define i512 @test3(i512 %a) nounwind {
22; CHECK-LABEL: test3
23; CHECK-NOT: %const = bitcast i512 504 to i512
24  %1 = shl i512 %a, 504
25  %2 = ashr i512 %1, 504
26  ret i512 %2
27}
28