annotate test/CodeGen/SystemZ/fp-abs-04.ll @ 128:c347d3398279 default tip

fix
author mir3636
date Wed, 06 Dec 2017 14:37:17 +0900
parents 803732b1fca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 ; Test negated floating-point absolute on z14.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 ;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 ; Test f32.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 declare float @llvm.fabs.f32(float %f)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 define float @f1(float %f) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 ; CHECK-LABEL: f1:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9 ; CHECK: lndfr %f0, %f0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 ; CHECK: br %r14
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 %abs = call float @llvm.fabs.f32(float %f)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 %res = fsub float -0.0, %abs
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 ret float %res
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 ; Test f64.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 declare double @llvm.fabs.f64(double %f)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 define double @f2(double %f) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 ; CHECK-LABEL: f2:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 ; CHECK: lndfr %f0, %f0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 ; CHECK: br %r14
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 %abs = call double @llvm.fabs.f64(double %f)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23 %res = fsub double -0.0, %abs
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 ret double %res
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 ; Test f128. With the loads and stores, a pure negative-absolute would
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 ; probably be better implemented using an OI on the upper byte. Do some
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 ; extra processing so that using FPRs is unequivocally better.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 declare fp128 @llvm.fabs.f128(fp128 %f)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 define void @f3(fp128 *%ptr, fp128 *%ptr2) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 ; CHECK-LABEL: f3:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 ; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 ; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 ; CHECK-DAG: wflnxb [[NEGREG1:%v[0-9]+]], [[REG1]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36 ; CHECK: wfdxb [[RES:%v[0-9]+]], [[NEGREG1]], [[REG2]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 ; CHECK: vst [[RES]], 0(%r2)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38 ; CHECK: br %r14
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39 %orig = load fp128 , fp128 *%ptr
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 %abs = call fp128 @llvm.fabs.f128(fp128 %orig)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 %negabs = fsub fp128 0xL00000000000000008000000000000000, %abs
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42 %op2 = load fp128 , fp128 *%ptr2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 %res = fdiv fp128 %negabs, %op2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 store fp128 %res, fp128 *%ptr
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45 ret void
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 }