mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-30 14:50:30 +00:00
[PowerPC] Add tests for select
patterns. NFC.
This commit is contained in:
parent
546a7d793e
commit
e87c3b7d7a
66
test/CodeGen/PowerPC/select.ll
Normal file
66
test/CodeGen/PowerPC/select.ll
Normal file
@ -0,0 +1,66 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -ppc-asm-full-reg-names -verify-machineinstrs \
|
||||
; RUN: -mtriple=powerpc64le-linux-gnu < %s | FileCheck \
|
||||
; RUN: -check-prefix=CHECK-LE %s
|
||||
|
||||
define i64 @f0(i64 %x) {
|
||||
; CHECK-LE-LABEL: f0:
|
||||
; CHECK-LE: # %bb.0:
|
||||
; CHECK-LE-NEXT: li r4, 125
|
||||
; CHECK-LE-NEXT: cmpdi r3, 0
|
||||
; CHECK-LE-NEXT: li r3, -3
|
||||
; CHECK-LE-NEXT: isellt r3, r3, r4
|
||||
; CHECK-LE-NEXT: blr
|
||||
%c = icmp slt i64 %x, 0
|
||||
%r = select i1 %c, i64 -3, i64 125
|
||||
ret i64 %r
|
||||
}
|
||||
|
||||
define i64 @f1(i64 %x) {
|
||||
; CHECK-LE-LABEL: f1:
|
||||
; CHECK-LE: # %bb.0:
|
||||
; CHECK-LE-NEXT: li r4, 512
|
||||
; CHECK-LE-NEXT: cmpdi r3, 0
|
||||
; CHECK-LE-NEXT: li r3, 64
|
||||
; CHECK-LE-NEXT: isellt r3, r3, r4
|
||||
; CHECK-LE-NEXT: blr
|
||||
%c = icmp slt i64 %x, 0
|
||||
%r = select i1 %c, i64 64, i64 512
|
||||
ret i64 %r
|
||||
}
|
||||
|
||||
define i64 @f2(i64 %x) {
|
||||
; CHECK-LE-LABEL: f2:
|
||||
; CHECK-LE: # %bb.0:
|
||||
; CHECK-LE-NEXT: li r4, 1024
|
||||
; CHECK-LE-NEXT: cmpdi r3, 0
|
||||
; CHECK-LE-NEXT: iseleq r3, 0, r4
|
||||
; CHECK-LE-NEXT: blr
|
||||
%c = icmp eq i64 %x, 0
|
||||
%r = select i1 %c, i64 0, i64 1024
|
||||
ret i64 %r
|
||||
}
|
||||
|
||||
define i64 @f3(i64 %x, i64 %y) {
|
||||
; CHECK-LE-LABEL: f3:
|
||||
; CHECK-LE: # %bb.0:
|
||||
; CHECK-LE-NEXT: cmpldi r3, 0
|
||||
; CHECK-LE-NEXT: iseleq r3, 0, r4
|
||||
; CHECK-LE-NEXT: blr
|
||||
%c = icmp eq i64 %x, 0
|
||||
%r = select i1 %c, i64 0, i64 %y
|
||||
ret i64 %r
|
||||
}
|
||||
|
||||
define i64 @f4(i64 %x) {
|
||||
; CHECK-LE-LABEL: f4:
|
||||
; CHECK-LE: # %bb.0:
|
||||
; CHECK-LE-NEXT: neg r4, r3
|
||||
; CHECK-LE-NEXT: cmpdi r3, 0
|
||||
; CHECK-LE-NEXT: iselgt r3, r4, r3
|
||||
; CHECK-LE-NEXT: blr
|
||||
%c = icmp sgt i64 %x, 0
|
||||
%x.neg = sub i64 0, %x
|
||||
%r = select i1 %c, i64 %x.neg, i64 %x
|
||||
ret i64 %r
|
||||
}
|
Loading…
Reference in New Issue
Block a user