1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv32 -mattr=+m | FileCheck %s --check-prefix=RISCV32
4 ; Test ADDCARRY node expansion on a target that does not currently support ADDCARRY.
5 ; Signed fixed point multiplication eventually expands down to an ADDCARRY.
7 declare i64 @llvm.smul.fix.i64 (i64, i64, i32)
9 define i64 @addcarry(i64 %x, i64 %y) nounwind {
10 ; RISCV32-LABEL: addcarry:
12 ; RISCV32-NEXT: mul a4, a0, a3
13 ; RISCV32-NEXT: mulhu a7, a0, a2
14 ; RISCV32-NEXT: add a4, a7, a4
15 ; RISCV32-NEXT: mul a5, a1, a2
16 ; RISCV32-NEXT: add a6, a4, a5
17 ; RISCV32-NEXT: sltu t0, a6, a4
18 ; RISCV32-NEXT: sltu a4, a4, a7
19 ; RISCV32-NEXT: mulhu a5, a0, a3
20 ; RISCV32-NEXT: add a4, a5, a4
21 ; RISCV32-NEXT: mulhu a5, a1, a2
22 ; RISCV32-NEXT: add a4, a4, a5
23 ; RISCV32-NEXT: add a4, a4, t0
24 ; RISCV32-NEXT: mul a5, a1, a3
25 ; RISCV32-NEXT: add a5, a4, a5
26 ; RISCV32-NEXT: bgez a1, .LBB0_2
27 ; RISCV32-NEXT: # %bb.1:
28 ; RISCV32-NEXT: sub a5, a5, a2
29 ; RISCV32-NEXT: .LBB0_2:
30 ; RISCV32-NEXT: bgez a3, .LBB0_4
31 ; RISCV32-NEXT: # %bb.3:
32 ; RISCV32-NEXT: sub a5, a5, a0
33 ; RISCV32-NEXT: .LBB0_4:
34 ; RISCV32-NEXT: slli a1, a5, 30
35 ; RISCV32-NEXT: srli a3, a6, 2
36 ; RISCV32-NEXT: or a1, a1, a3
37 ; RISCV32-NEXT: slli a3, a6, 30
38 ; RISCV32-NEXT: mul a0, a0, a2
39 ; RISCV32-NEXT: srli a0, a0, 2
40 ; RISCV32-NEXT: or a0, a3, a0
42 %tmp = call i64 @llvm.smul.fix.i64(i64 %x, i64 %y, i32 2);