1 ; RUN: opt -mtriple=riscv32-unknown-elf -S -consthoist < %s | FileCheck %s
2 ; RUN: opt -mtriple=riscv64-unknown-elf -S -consthoist < %s | FileCheck %s
4 ; Check that we don't hoist immediates with small values.
5 define i64 @test1(i64 %a) nounwind {
7 ; CHECK-NOT: %const = bitcast i64 2 to i64
13 ; Check that we don't hoist immediates with small values.
14 define i64 @test2(i64 %a) nounwind {
16 ; CHECK-NOT: %const = bitcast i64 2047 to i64
22 ; Check that we hoist immediates with large values.
23 define i64 @test3(i64 %a) nounwind {
25 ; CHECK: %const = bitcast i64 32767 to i64
26 %1 = mul i64 %a, 32767
27 %2 = add i64 %1, 32767
31 ; Check that we hoist immediates with very large values.
32 define i128 @test4(i128 %a) nounwind {
34 ; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
35 %1 = add i128 %a, 12297829382473034410122878
36 %2 = add i128 %1, 12297829382473034410122878