xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/fp-cmp-03.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test 128-bit floating-point comparison.  The tests assume a z10 implementation
2*9880d681SAndroid Build Coastguard Worker; of select, using conditional branches rather than LOCGR.
3*9880d681SAndroid Build Coastguard Worker;
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; There is no memory form of 128-bit comparison.
7*9880d681SAndroid Build Coastguard Workerdefine i64 @f1(i64 %a, i64 %b, fp128 *%ptr, float %f2) {
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: lxebr %f0, %f0
10*9880d681SAndroid Build Coastguard Worker; CHECK: ld %f1, 0(%r4)
11*9880d681SAndroid Build Coastguard Worker; CHECK: ld %f3, 8(%r4)
12*9880d681SAndroid Build Coastguard Worker; CHECK: cxbr %f1, %f0
13*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ber %r14
14*9880d681SAndroid Build Coastguard Worker; CHECK: lgr %r2, %r3
15*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
16*9880d681SAndroid Build Coastguard Worker  %f2x = fpext float %f2 to fp128
17*9880d681SAndroid Build Coastguard Worker  %f1 = load fp128 , fp128 *%ptr
18*9880d681SAndroid Build Coastguard Worker  %cond = fcmp oeq fp128 %f1, %f2x
19*9880d681SAndroid Build Coastguard Worker  %res = select i1 %cond, i64 %a, i64 %b
20*9880d681SAndroid Build Coastguard Worker  ret i64 %res
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; Check comparison with zero.
24*9880d681SAndroid Build Coastguard Workerdefine i64 @f2(i64 %a, i64 %b, fp128 *%ptr) {
25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
26*9880d681SAndroid Build Coastguard Worker; CHECK: ld %f0, 0(%r4)
27*9880d681SAndroid Build Coastguard Worker; CHECK: ld %f2, 8(%r4)
28*9880d681SAndroid Build Coastguard Worker; CHECK: ltxbr %f0, %f0
29*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ber %r14
30*9880d681SAndroid Build Coastguard Worker; CHECK: lgr %r2, %r3
31*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
32*9880d681SAndroid Build Coastguard Worker  %f = load fp128 , fp128 *%ptr
33*9880d681SAndroid Build Coastguard Worker  %cond = fcmp oeq fp128 %f, 0xL00000000000000000000000000000000
34*9880d681SAndroid Build Coastguard Worker  %res = select i1 %cond, i64 %a, i64 %b
35*9880d681SAndroid Build Coastguard Worker  ret i64 %res
36*9880d681SAndroid Build Coastguard Worker}
37