mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
XCore target: add XCoreTargetLowering::isZExtFree()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c879eabcc2
commit
7b5376659c
@ -166,6 +166,24 @@ XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM)
|
||||
setMinFunctionAlignment(1);
|
||||
}
|
||||
|
||||
bool XCoreTargetLowering::isZExtFree(SDValue Val, EVT VT2) const {
|
||||
if (Val.getOpcode() != ISD::LOAD)
|
||||
return false;
|
||||
|
||||
EVT VT1 = Val.getValueType();
|
||||
if (!VT1.isSimple() || !VT1.isInteger() ||
|
||||
!VT2.isSimple() || !VT2.isInteger())
|
||||
return false;
|
||||
|
||||
switch (VT1.getSimpleVT().SimpleTy) {
|
||||
default: break;
|
||||
case MVT::i8:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
SDValue XCoreTargetLowering::
|
||||
LowerOperation(SDValue Op, SelectionDAG &DAG) const {
|
||||
switch (Op.getOpcode())
|
||||
|
@ -83,6 +83,10 @@ namespace llvm {
|
||||
|
||||
explicit XCoreTargetLowering(XCoreTargetMachine &TM);
|
||||
|
||||
using TargetLowering::isZExtFree;
|
||||
virtual bool isZExtFree(SDValue Val, EVT VT2) const;
|
||||
|
||||
|
||||
virtual unsigned getJumpTableEncoding() const;
|
||||
virtual MVT getScalarShiftAmountTy(EVT LHSTy) const { return MVT::i32; }
|
||||
|
||||
|
15
test/CodeGen/XCore/zextfree.ll
Normal file
15
test/CodeGen/XCore/zextfree.ll
Normal file
@ -0,0 +1,15 @@
|
||||
; RUN: llc -march=xcore < %s | FileCheck %s
|
||||
|
||||
; CHECK-LABEL: test:
|
||||
; CHECK-NOT: zext
|
||||
define void @test(i8* %s1) {
|
||||
entry:
|
||||
%u8 = load i8* %s1, align 1
|
||||
%bool = icmp eq i8 %u8, 0
|
||||
br label %BB1
|
||||
BB1:
|
||||
br i1 %bool, label %BB1, label %BB2
|
||||
BB2:
|
||||
br i1 %bool, label %BB1, label %BB2
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user