2018-04-12 13:50:06 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < %s \
|
|
|
|
; RUN: | FileCheck -check-prefix=RV32IFD %s
|
|
|
|
|
|
|
|
define double @test(double %a) nounwind {
|
|
|
|
; RV32IFD-LABEL: test:
|
|
|
|
; RV32IFD: # %bb.0:
|
|
|
|
; RV32IFD-NEXT: ret
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
|
|
|
; This previously failed complaining of multiple vreg defs due to an ABI
|
|
|
|
; lowering issue.
|
|
|
|
|
|
|
|
define i32 @main() nounwind {
|
|
|
|
; RV32IFD-LABEL: main:
|
|
|
|
; RV32IFD: # %bb.0: # %entry
|
|
|
|
; RV32IFD-NEXT: addi sp, sp, -16
|
|
|
|
; RV32IFD-NEXT: sw ra, 12(sp)
|
2019-09-17 18:52:09 +08:00
|
|
|
; RV32IFD-NEXT: lui a1, 262144
|
2019-09-17 19:15:35 +08:00
|
|
|
; RV32IFD-NEXT: mv a0, zero
|
2018-04-25 22:19:12 +08:00
|
|
|
; RV32IFD-NEXT: call test
|
2018-04-12 13:50:06 +08:00
|
|
|
; RV32IFD-NEXT: sw a0, 0(sp)
|
|
|
|
; RV32IFD-NEXT: sw a1, 4(sp)
|
|
|
|
; RV32IFD-NEXT: fld ft0, 0(sp)
|
2019-03-30 17:15:47 +08:00
|
|
|
; RV32IFD-NEXT: lui a0, %hi(.LCPI1_0)
|
2020-05-12 01:52:42 +08:00
|
|
|
; RV32IFD-NEXT: fld ft1, %lo(.LCPI1_0)(a0)
|
2019-03-30 17:15:47 +08:00
|
|
|
; RV32IFD-NEXT: lui a0, %hi(.LCPI1_1)
|
[RISCV] Implement Hooks to avoid chaining SELECT
Summary:
This implements two hooks that attempt to avoid control flow for RISC-V. RISC-V
will lower SELECTs into control flow, which is not a great idea.
The hook `hasMultipleConditionRegisters()` turns off the following
DAGCombiner folds:
select(C0|C1, x, y) <=> select(C0, x, select(C1, x, y))
select(C0&C1, x, y) <=> select(C0, select(C1, x, y), y)
The second hook `setJumpIsExpensive` controls a flag that has a similar purpose
and is used in CodeGenPrepare and the SelectionDAGBuilder.
Both of these have the effect of ensuring more logic is done before fewer jumps.
Note: with the `B` extension, we may be able to lower select into a conditional
move instruction, so at some point these hooks will need to be guarded based on
enabled extensions.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D79268
2020-07-01 18:55:07 +08:00
|
|
|
; RV32IFD-NEXT: fld ft2, %lo(.LCPI1_1)(a0)
|
|
|
|
; RV32IFD-NEXT: flt.d a0, ft0, ft1
|
|
|
|
; RV32IFD-NEXT: not a0, a0
|
|
|
|
; RV32IFD-NEXT: flt.d a1, ft2, ft0
|
|
|
|
; RV32IFD-NEXT: xori a1, a1, 1
|
|
|
|
; RV32IFD-NEXT: and a0, a0, a1
|
|
|
|
; RV32IFD-NEXT: bnez a0, .LBB1_2
|
|
|
|
; RV32IFD-NEXT: # %bb.1: # %if.then
|
|
|
|
; RV32IFD-NEXT: call abort
|
|
|
|
; RV32IFD-NEXT: .LBB1_2: # %if.end
|
2018-04-12 13:50:06 +08:00
|
|
|
; RV32IFD-NEXT: mv a0, zero
|
2018-04-25 22:19:12 +08:00
|
|
|
; RV32IFD-NEXT: call exit
|
2018-04-12 13:50:06 +08:00
|
|
|
entry:
|
|
|
|
%call = call double @test(double 2.000000e+00)
|
|
|
|
%cmp = fcmp olt double %call, 2.400000e-01
|
|
|
|
%cmp2 = fcmp ogt double %call, 2.600000e-01
|
|
|
|
%or.cond = or i1 %cmp, %cmp2
|
|
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
call void @abort()
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
if.end:
|
|
|
|
call void @exit(i32 0)
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @abort()
|
|
|
|
|
|
|
|
declare void @exit(i32)
|