2013-05-28 12:41:11 +02:00
|
|
|
; Test all condition-code masks that are relevant for CGRJ.
|
|
|
|
;
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
|
2013-06-27 11:49:34 +02:00
|
|
|
declare i64 @foo()
|
2013-05-28 12:41:11 +02:00
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test EQ.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f1(i64 %target) {
|
|
|
|
; CHECK: f1:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrje %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp eq i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test NE.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f2(i64 %target) {
|
|
|
|
; CHECK: f2:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjlh %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp ne i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test SLE.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f3(i64 %target) {
|
|
|
|
; CHECK: f3:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjle %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sle i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test SLT.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f4(i64 %target) {
|
|
|
|
; CHECK: f4:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjl %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp slt i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test SGT.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f5(i64 %target) {
|
|
|
|
; CHECK: f5:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjh %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sgt i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-12 11:17:10 +02:00
|
|
|
; Test SGE.
|
2013-05-28 12:41:11 +02:00
|
|
|
define void @f6(i64 %target) {
|
|
|
|
; CHECK: f6:
|
|
|
|
; CHECK: .cfi_def_cfa_offset
|
|
|
|
; CHECK: .L[[LABEL:.*]]:
|
|
|
|
; CHECK: cgrjhe %r2, {{%r[0-9]+}}, .L[[LABEL]]
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%val = call i64 @foo()
|
|
|
|
%cond = icmp sge i64 %val, %target
|
|
|
|
br i1 %cond, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|
2013-07-12 11:17:10 +02:00
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i32 EQ.
|
|
|
|
define i64 @f7(i64 %a, i64 %b) {
|
|
|
|
; CHECK: f7:
|
|
|
|
; CHECK: lhi [[REG:%r[0-5]]], -1
|
|
|
|
; CHECK: crje {{%r[0-5]}}
|
|
|
|
; CHECK: lhi [[REG]], 0
|
|
|
|
; CHECK-NOT: sra
|
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp eq <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i32>
|
|
|
|
%ret = bitcast <2 x i32> %ext to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i32 NE.
|
|
|
|
define i64 @f8(i64 %a, i64 %b) {
|
|
|
|
; CHECK: f8:
|
|
|
|
; CHECK: lhi [[REG:%r[0-5]]], -1
|
|
|
|
; CHECK: crjlh {{%r[0-5]}}
|
|
|
|
; CHECK: lhi [[REG]], 0
|
|
|
|
; CHECK-NOT: sra
|
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp ne <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i32>
|
|
|
|
%ret = bitcast <2 x i32> %ext to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i64 EQ.
|
|
|
|
define void @f9(i64 %a, i64 %b, <2 x i64> *%dest) {
|
|
|
|
; CHECK: f9:
|
|
|
|
; CHECK: lghi [[REG:%r[0-5]]], -1
|
|
|
|
; CHECK: crje {{%r[0-5]}}
|
|
|
|
; CHECK: lghi [[REG]], 0
|
|
|
|
; CHECK-NOT: sra
|
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp eq <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i64>
|
|
|
|
store <2 x i64> %ext, <2 x i64> *%dest
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i64 NE.
|
|
|
|
define void @f10(i64 %a, i64 %b, <2 x i64> *%dest) {
|
|
|
|
; CHECK: f10:
|
|
|
|
; CHECK: lghi [[REG:%r[0-5]]], -1
|
|
|
|
; CHECK: crjlh {{%r[0-5]}}
|
|
|
|
; CHECK: lghi [[REG]], 0
|
|
|
|
; CHECK-NOT: sra
|
|
|
|
; CHECK: br %r14
|
|
|
|
%avec = bitcast i64 %a to <2 x i32>
|
|
|
|
%bvec = bitcast i64 %b to <2 x i32>
|
|
|
|
%cmp = icmp ne <2 x i32> %avec, %bvec
|
|
|
|
%ext = sext <2 x i1> %cmp to <2 x i64>
|
|
|
|
store <2 x i64> %ext, <2 x i64> *%dest
|
|
|
|
ret void
|
|
|
|
}
|