1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < %s \
3; RUN:   | FileCheck -check-prefix=RV32IFD %s
4
5define double @test(double %a) nounwind {
6; RV32IFD-LABEL: test:
7; RV32IFD:       # %bb.0:
8; RV32IFD-NEXT:    ret
9  ret double %a
10}
11
12; This previously failed complaining of multiple vreg defs due to an ABI
13; lowering issue.
14
15define i32 @main() nounwind {
16; RV32IFD-LABEL: main:
17; RV32IFD:       # %bb.0: # %entry
18; RV32IFD-NEXT:    addi sp, sp, -16
19; RV32IFD-NEXT:    sw ra, 12(sp)
20; RV32IFD-NEXT:    lui a1, 262144
21; RV32IFD-NEXT:    mv a0, zero
22; RV32IFD-NEXT:    call test
23; RV32IFD-NEXT:    sw a0, 0(sp)
24; RV32IFD-NEXT:    sw a1, 4(sp)
25; RV32IFD-NEXT:    fld ft0, 0(sp)
26; RV32IFD-NEXT:    lui a0, %hi(.LCPI1_0)
27; RV32IFD-NEXT:    fld ft1, %lo(.LCPI1_0)(a0)
28; RV32IFD-NEXT:    lui a0, %hi(.LCPI1_1)
29; RV32IFD-NEXT:    fld ft2, %lo(.LCPI1_1)(a0)
30; RV32IFD-NEXT:    flt.d a0, ft0, ft1
31; RV32IFD-NEXT:    not a0, a0
32; RV32IFD-NEXT:    flt.d a1, ft2, ft0
33; RV32IFD-NEXT:    xori a1, a1, 1
34; RV32IFD-NEXT:    and a0, a0, a1
35; RV32IFD-NEXT:    bnez a0, .LBB1_2
36; RV32IFD-NEXT:  # %bb.1: # %if.then
37; RV32IFD-NEXT:    call abort
38; RV32IFD-NEXT:  .LBB1_2: # %if.end
39; RV32IFD-NEXT:    mv a0, zero
40; RV32IFD-NEXT:    call exit
41entry:
42  %call = call double @test(double 2.000000e+00)
43  %cmp = fcmp olt double %call, 2.400000e-01
44  %cmp2 = fcmp ogt double %call, 2.600000e-01
45  %or.cond = or i1 %cmp, %cmp2
46  br i1 %or.cond, label %if.then, label %if.end
47
48if.then:
49  call void @abort()
50  unreachable
51
52if.end:
53  call void @exit(i32 0)
54  unreachable
55}
56
57declare void @abort()
58
59declare void @exit(i32)
60