forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MSP430] Declare comparison LibCalls as returning i16 instead of i32
For TI's distribution of msp430-gcc ``` msp430-elf-gcc -S -o- -Os -x c - <<< "int f(float a, float b) { return a != b; }" ``` does not mention `R13` at all. `__libgcc_cmp_return__` machine mode is 2 byte on MSP430, as well. Differential Revision: https://reviews.llvm.org/D82635
- Loading branch information
1 parent
4f5133a
commit 19e7571
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |