mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-23 19:59:57 +00:00
85745f9561
Use mask and negate for legalization of i1 source type with SIGN_EXTEND_INREG. With the mask, this should be no worse than 2 shifts. The mask can be eliminated in some cases, so that should be better than 2 shifts. This change exposed some missing folds related to negation: https://reviews.llvm.org/rL284239 https://reviews.llvm.org/rL284395 There may be others, so please let me know if you see any regressions. Differential Revision: https://reviews.llvm.org/D25485 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284611 91177308-0d34-0410-b5e6-96231b3b80d8
26 lines
581 B
LLVM
26 lines
581 B
LLVM
; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s
|
|
|
|
; PR30660 - https://llvm.org/bugs/show_bug.cgi?id=30660
|
|
|
|
define i32 @select_i32_neg1_or_0(i1 %a) {
|
|
; CHECK-LABEL: select_i32_neg1_or_0:
|
|
; CHECK-NEXT: @ BB#0:
|
|
; CHECK-NEXT: and r0, r0, #1
|
|
; CHECK-NEXT: rsb r0, r0, #0
|
|
; CHECK-NEXT: mov pc, lr
|
|
;
|
|
%b = sext i1 %a to i32
|
|
ret i32 %b
|
|
}
|
|
|
|
define i32 @select_i32_neg1_or_0_zeroext(i1 zeroext %a) {
|
|
; CHECK-LABEL: select_i32_neg1_or_0_zeroext:
|
|
; CHECK-NEXT: @ BB#0:
|
|
; CHECK-NEXT: rsb r0, r0, #0
|
|
; CHECK-NEXT: mov pc, lr
|
|
;
|
|
%b = sext i1 %a to i32
|
|
ret i32 %b
|
|
}
|
|
|