2013-05-28 18:41:11 +08:00
|
|
|
; Test all condition-code masks that are relevant for CGRJ.
|
|
|
|
;
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
|
2013-06-27 17:49:34 +08:00
|
|
|
declare i64 @foo()
|
2013-05-28 18:41:11 +08:00
|
|
|
|
2013-07-12 17:17:10 +08:00
|
|
|
; Test EQ.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f1(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
; Test NE.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f2(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
; Test SLE.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f3(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
; Test SLT.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f4(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f4:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
; Test SGT.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f5(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f5:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
; Test SGE.
|
2013-05-28 18:41:11 +08:00
|
|
|
define void @f6(i64 %target) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f6:
|
2013-05-28 18:41:11 +08:00
|
|
|
; 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 17:17:10 +08:00
|
|
|
|
|
|
|
; Test a vector of 0/-1 results for i32 EQ.
|
|
|
|
define i64 @f7(i64 %a, i64 %b) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f7:
|
2013-07-12 17:17:10 +08:00
|
|
|
; 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) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f8:
|
2013-07-12 17:17:10 +08:00
|
|
|
; 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) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f9:
|
2013-07-12 17:17:10 +08:00
|
|
|
; 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) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f10:
|
2013-07-12 17:17:10 +08:00
|
|
|
; 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
|
|
|
|
}
|