SimplifyDemandedBits tries to agressively turn xor immediates into -1 to match a 'not' instruction. In this case, because X is a boolean, the upper bits of (xor X, 1) are known to be 0. Because this is an AND instruction, that means those bits aren't demanded from the other operand, and thus SimplifyDemandedBits can turn (xor Y, 1) to (not Y). We need to detect that this has happened to enable the DeMorgan optimization. To do this we allow one of the xors to use -1 when the outer operation is And. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D132671
57 lines
1.6 KiB
LLVM
57 lines
1.6 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32 -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) # 4-byte Folded Spill
|
|
; RV32IFD-NEXT: lui a1, 262144
|
|
; RV32IFD-NEXT: li a0, 0
|
|
; RV32IFD-NEXT: call test@plt
|
|
; RV32IFD-NEXT: sw a0, 0(sp)
|
|
; RV32IFD-NEXT: sw a1, 4(sp)
|
|
; RV32IFD-NEXT: fld ft0, 0(sp)
|
|
; RV32IFD-NEXT: lui a0, %hi(.LCPI1_0)
|
|
; RV32IFD-NEXT: fld ft1, %lo(.LCPI1_0)(a0)
|
|
; RV32IFD-NEXT: lui a0, %hi(.LCPI1_1)
|
|
; RV32IFD-NEXT: fld ft2, %lo(.LCPI1_1)(a0)
|
|
; RV32IFD-NEXT: flt.d a0, ft0, ft1
|
|
; RV32IFD-NEXT: flt.d a1, ft2, ft0
|
|
; RV32IFD-NEXT: or a0, a0, a1
|
|
; RV32IFD-NEXT: beqz a0, .LBB1_2
|
|
; RV32IFD-NEXT: # %bb.1: # %if.then
|
|
; RV32IFD-NEXT: call abort@plt
|
|
; RV32IFD-NEXT: .LBB1_2: # %if.end
|
|
; RV32IFD-NEXT: call exit@plt
|
|
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)
|