1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv64 -mattr=+m | FileCheck %s
4 define i32 @f(i1 %0, i32 %1, ptr %2) {
6 ; CHECK: # %bb.0: # %BB
7 ; CHECK-NEXT: slli a0, a0, 63
8 ; CHECK-NEXT: srai a0, a0, 63
9 ; CHECK-NEXT: lui a3, 4097
10 ; CHECK-NEXT: addiw a3, a3, -2047
11 ; CHECK-NEXT: or a0, a0, a3
12 ; CHECK-NEXT: mul a1, a1, a3
13 ; CHECK-NEXT: sw a1, 0(a2)
16 %I = select i1 %0, i32 -1, i32 0
17 %I1 = mul i32 %1, 16779265
18 %I2 = or i32 16779265, %I
23 define i32 @g(i1 %0, i32 %1, ptr %2) {
25 ; CHECK: # %bb.0: # %BB
26 ; CHECK-NEXT: andi a0, a0, 1
27 ; CHECK-NEXT: addi a0, a0, -1
28 ; CHECK-NEXT: lui a3, 4097
29 ; CHECK-NEXT: addiw a3, a3, -2047
30 ; CHECK-NEXT: or a0, a0, a3
31 ; CHECK-NEXT: mul a1, a1, a3
32 ; CHECK-NEXT: sw a1, 0(a2)
35 %I = select i1 %0, i32 0, i32 -1
36 %I1 = mul i32 %1, 16779265
37 %I2 = or i32 16779265, %I
42 define i32 @h(i1 %0, i32 %1, ptr %2) {
44 ; CHECK: # %bb.0: # %BB
45 ; CHECK-NEXT: lui a3, 4097
46 ; CHECK-NEXT: addiw a3, a3, -2047
47 ; CHECK-NEXT: mul a1, a1, a3
48 ; CHECK-NEXT: slli a0, a0, 63
49 ; CHECK-NEXT: srai a0, a0, 63
50 ; CHECK-NEXT: and a0, a0, a3
51 ; CHECK-NEXT: sw a1, 0(a2)
54 %I = select i1 %0, i32 -1, i32 0
55 %I1 = mul i32 %1, 16779265
56 %I2 = and i32 16779265, %I
61 define i32 @i(i1 %0, i32 %1, ptr %2) {
63 ; CHECK: # %bb.0: # %BB
64 ; CHECK-NEXT: andi a0, a0, 1
65 ; CHECK-NEXT: lui a3, 4097
66 ; CHECK-NEXT: addiw a3, a3, -2047
67 ; CHECK-NEXT: mul a1, a1, a3
68 ; CHECK-NEXT: addi a0, a0, -1
69 ; CHECK-NEXT: and a0, a0, a3
70 ; CHECK-NEXT: sw a1, 0(a2)
73 %I = select i1 %0, i32 0, i32 -1
74 %I1 = mul i32 %1, 16779265
75 %I2 = and i32 16779265, %I