[llvm] r192431 - XCore target: add XCoreTargetLowering::isZExtFree()
Robert Lytton
robert at xmos.com
Fri Oct 11 03:26:30 PDT 2013
Author: rlytton
Date: Fri Oct 11 05:26:29 2013
New Revision: 192431
URL: http://llvm.org/viewvc/llvm-project?rev=192431&view=rev
Log:
XCore target: add XCoreTargetLowering::isZExtFree()
Added:
llvm/trunk/test/CodeGen/XCore/zextfree.ll
Modified:
llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
llvm/trunk/lib/Target/XCore/XCoreISelLowering.h
Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=192431&r1=192430&r2=192431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Fri Oct 11 05:26:29 2013
@@ -166,6 +166,24 @@ XCoreTargetLowering::XCoreTargetLowering
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())
Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=192431&r1=192430&r2=192431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Fri Oct 11 05:26:29 2013
@@ -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; }
Added: llvm/trunk/test/CodeGen/XCore/zextfree.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/zextfree.ll?rev=192431&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/zextfree.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/zextfree.ll Fri Oct 11 05:26:29 2013
@@ -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
+}
+
More information about the llvm-commits
mailing list