[SystemZ] Add floating-point load-and-test instructions
[oota-llvm.git] / test / CodeGen / SystemZ / fp-cmp-03.ll
1 ; Test 128-bit floating-point comparison.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5 ; There is no memory form of 128-bit comparison.
6 define i64 @f1(i64 %a, i64 %b, fp128 *%ptr, float %f2) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: lxebr %f0, %f0
9 ; CHECK: ld %f1, 0(%r4)
10 ; CHECK: ld %f3, 8(%r4)
11 ; CHECK: cxbr %f1, %f0
12 ; CHECK-NEXT: je
13 ; CHECK: lgr %r2, %r3
14 ; CHECK: br %r14
15   %f2x = fpext float %f2 to fp128
16   %f1 = load fp128 *%ptr
17   %cond = fcmp oeq fp128 %f1, %f2x
18   %res = select i1 %cond, i64 %a, i64 %b
19   ret i64 %res
20 }
21
22 ; Check comparison with zero.
23 define i64 @f2(i64 %a, i64 %b, fp128 *%ptr) {
24 ; CHECK-LABEL: f2:
25 ; CHECK: ld %f0, 0(%r4)
26 ; CHECK: ld %f2, 8(%r4)
27 ; CHECK: ltxbr %f0, %f0
28 ; CHECK-NEXT: je
29 ; CHECK: lgr %r2, %r3
30 ; CHECK: br %r14
31   %f = load fp128 *%ptr
32   %cond = fcmp oeq fp128 %f, 0xL00000000000000000000000000000000
33   %res = select i1 %cond, i64 %a, i64 %b
34   ret i64 %res
35 }