1; Test f64 and v2f64 absolute.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5declare double @llvm.fabs.f64(double)
6declare <2 x double> @llvm.fabs.v2f64(<2 x double>)
7
8; Test a plain absolute.
9define <2 x double> @f1(<2 x double> %val) {
10; CHECK-LABEL: f1:
11; CHECK: vflpdb %v24, %v24
12; CHECK: br %r14
13  %ret = call <2 x double> @llvm.fabs.v2f64(<2 x double> %val)
14  ret <2 x double> %ret
15}
16
17; Test a negative absolute.
18define <2 x double> @f2(<2 x double> %val) {
19; CHECK-LABEL: f2:
20; CHECK: vflndb %v24, %v24
21; CHECK: br %r14
22  %abs = call <2 x double> @llvm.fabs.v2f64(<2 x double> %val)
23  %ret = fneg <2 x double> %abs
24  ret <2 x double> %ret
25}
26
27; Test an f64 absolute that uses vector registers.
28define double @f3(<2 x double> %val) {
29; CHECK-LABEL: f3:
30; CHECK: wflpdb %f0, %v24
31; CHECK: br %r14
32  %scalar = extractelement <2 x double> %val, i32 0
33  %ret = call double @llvm.fabs.f64(double %scalar)
34  ret double %ret
35}
36
37; Test an f64 negative absolute that uses vector registers.
38define double @f4(<2 x double> %val) {
39; CHECK-LABEL: f4:
40; CHECK: wflndb %f0, %v24
41; CHECK: br %r14
42  %scalar = extractelement <2 x double> %val, i32 0
43  %abs = call double @llvm.fabs.f64(double %scalar)
44  %ret = fneg double %abs
45  ret double %ret
46}
47