[PATCH] D82635: [MSP430] Declare comparison LibCalls as returning i16 instead of i32
Anton Korobeynikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 01:35:22 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG19e75717eff2: [MSP430] Declare comparison LibCalls as returning i16 instead of i32 (authored by atrosinenko, committed by asl).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82635/new/
https://reviews.llvm.org/D82635
Files:
llvm/lib/Target/MSP430/MSP430ISelLowering.h
llvm/test/CodeGen/MSP430/cmp-return-type.ll
Index: llvm/test/CodeGen/MSP430/cmp-return-type.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MSP430/cmp-return-type.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
+target triple = "msp430"
+
+define i16 @f(float %a, float %b) optsize {
+ %cmp = fcmp une float %a, %b
+ %conv = zext i1 %cmp to i16
+; CHECK-LABEL: call #__mspabi_cmpf
+; CHECK-NOT: r13
+; CHECK-LABEL: mov r2
+
+; This is quite fragile attempt to detect the return type:
+; Correct:
+; call #__mspabi_cmpf
+; tst r12
+; mov r2, r13
+; Incorrect:
+; call #__mspabi_cmpf
+; bis r12, r13 <-- checking (R12:R13)
+; tst r13
+; mov r2, r13
+
+ ret i16 %conv
+}
Index: llvm/lib/Target/MSP430/MSP430ISelLowering.h
===================================================================
--- llvm/lib/Target/MSP430/MSP430ISelLowering.h
+++ llvm/lib/Target/MSP430/MSP430ISelLowering.h
@@ -79,6 +79,10 @@
return MVT::i8;
}
+ MVT::SimpleValueType getCmpLibcallReturnType() const override {
+ return MVT::i16;
+ }
+
/// LowerOperation - Provide custom lowering hooks for some operations.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82635.274364.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/ddac45ec/attachment.bin>
More information about the llvm-commits
mailing list