[PATCH] D59748: [MSP430] Manually set setCC type for vectors
Afonso Bordado via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 24 08:21:33 PDT 2019
INdek created this revision.
INdek added reviewers: mskvortsov, asl.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Avoids triggering the "No default SetCC type for vectors!" assert.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59748
Files:
llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
llvm/lib/Target/MSP430/MSP430ISelLowering.h
llvm/test/CodeGen/MSP430/get-setcc-result-type.ll
Index: llvm/test/CodeGen/MSP430/get-setcc-result-type.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MSP430/get-setcc-result-type.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=msp430 < %s | FileCheck %s
+
+target datalayout = "e-p:16:8:8-i8:8:8-i8:8:8-i32:8:8"
+target triple = "msp430-generic-generic"
+
+define void @getSetCCResultType(<1 x i16>* %p, <1 x i16>* %q) {
+; CHECK-LABEL: getSetCCResultType:
+; CHECK: tst 0(r12)
+; CHECK-NEXT: mov r2, r13
+; CHECK-NEXT: rra r13
+; CHECK-NEXT: and #1, r13
+; CHECK-NEXT: clr r14
+; CHECK-NEXT: sub r13, r14
+; CHECK-NEXT: mov r14, 0(r12)
+; CHECK-NEXT: ret
+entry:
+ %0 = load <1 x i16>, <1 x i16>* %p, align 16
+ %cmp = icmp eq <1 x i16> %0, zeroinitializer
+ %sext = sext <1 x i1> %cmp to <1 x i16>
+ store <1 x i16> %sext, <1 x i16>* %p, align 16
+ ret void
+}
Index: llvm/lib/Target/MSP430/MSP430ISelLowering.h
===================================================================
--- llvm/lib/Target/MSP430/MSP430ISelLowering.h
+++ llvm/lib/Target/MSP430/MSP430ISelLowering.h
@@ -130,6 +130,8 @@
MachineBasicBlock *EmitShiftInstr(MachineInstr &MI,
MachineBasicBlock *BB) const;
+ EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
+ EVT VT) const override;
private:
SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee,
CallingConv::ID CallConv, bool isVarArg,
Index: llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
===================================================================
--- llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
+++ llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
@@ -1603,3 +1603,11 @@
MI.eraseFromParent(); // The pseudo instruction is gone now.
return BB;
}
+
+EVT MSP430TargetLowering::getSetCCResultType(const DataLayout &DL, LLVMContext &,
+ EVT VT) const {
+ if (!VT.isVector())
+ return getPointerTy(DL);
+
+ return VT.changeVectorElementTypeToInteger();
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59748.192033.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190324/ad132261/attachment.bin>
More information about the llvm-commits
mailing list