1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown \
3 ; RUN: -ppc-asm-full-reg-names -verify-machineinstrs -O2 < %s | FileCheck %s
5 define float @absf(float %a) {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: fabs f1, f1
11 %conv = bitcast float %a to i32
12 %and = and i32 %conv, 2147483647
13 %conv1 = bitcast i32 %and to float
17 define double @absd(double %a) {
19 ; CHECK: # %bb.0: # %entry
20 ; CHECK-NEXT: xsabsdp f1, f1
23 %conv = bitcast double %a to i64
24 %and = and i64 %conv, 9223372036854775807
25 %conv1 = bitcast i64 %and to double
29 define <4 x float> @absv4f32(<4 x float> %a) {
30 ; CHECK-LABEL: absv4f32:
31 ; CHECK: # %bb.0: # %entry
32 ; CHECK-NEXT: xvabssp vs34, vs34
35 %conv = bitcast <4 x float> %a to <4 x i32>
36 %and = and <4 x i32> %conv, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
37 %conv1 = bitcast <4 x i32> %and to <4 x float>
38 ret <4 x float> %conv1
41 define <4 x float> @absv4f32_wundef(<4 x float> %a) {
42 ; CHECK-LABEL: absv4f32_wundef:
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: xvabssp vs34, vs34
47 %conv = bitcast <4 x float> %a to <4 x i32>
48 %and = and <4 x i32> %conv, <i32 2147483647, i32 undef, i32 undef, i32 2147483647>
49 %conv1 = bitcast <4 x i32> %and to <4 x float>
50 ret <4 x float> %conv1
53 define <4 x float> @absv4f32_invalid(<4 x float> %a) {
54 ; CHECK-LABEL: absv4f32_invalid:
55 ; CHECK: # %bb.0: # %entry
56 ; CHECK-NEXT: addis r3, r2, .LCPI4_0@toc@ha
57 ; CHECK-NEXT: addi r3, r3, .LCPI4_0@toc@l
58 ; CHECK-NEXT: lvx v3, 0, r3
59 ; CHECK-NEXT: xxland vs34, vs34, vs35
62 %conv = bitcast <4 x float> %a to <4 x i32>
63 %and = and <4 x i32> %conv, <i32 2147483646, i32 2147483647, i32 2147483647, i32 2147483647>
64 %conv1 = bitcast <4 x i32> %and to <4 x float>
65 ret <4 x float> %conv1
68 define <2 x double> @absv2f64(<2 x double> %a) {
69 ; CHECK-LABEL: absv2f64:
70 ; CHECK: # %bb.0: # %entry
71 ; CHECK-NEXT: xvabsdp vs34, vs34
74 %conv = bitcast <2 x double> %a to <2 x i64>
75 %and = and <2 x i64> %conv, <i64 9223372036854775807, i64 9223372036854775807>
76 %conv1 = bitcast <2 x i64> %and to <2 x double>
77 ret <2 x double> %conv1
80 define float @negf(float %a) {
82 ; CHECK: # %bb.0: # %entry
83 ; CHECK-NEXT: fneg f1, f1
86 %conv = bitcast float %a to i32
87 %and = xor i32 %conv, -2147483648
88 %conv1 = bitcast i32 %and to float
92 define double @negd(double %a) {
94 ; CHECK: # %bb.0: # %entry
95 ; CHECK-NEXT: xsnegdp f1, f1
98 %conv = bitcast double %a to i64
99 %and = xor i64 %conv, -9223372036854775808
100 %conv1 = bitcast i64 %and to double
104 define <4 x float> @negv4f32(<4 x float> %a) {
105 ; CHECK-LABEL: negv4f32:
106 ; CHECK: # %bb.0: # %entry
107 ; CHECK-NEXT: xvnegsp vs34, vs34
110 %conv = bitcast <4 x float> %a to <4 x i32>
111 %and = xor <4 x i32> %conv, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>
112 %conv1 = bitcast <4 x i32> %and to <4 x float>
113 ret <4 x float> %conv1
116 define <2 x double> @negv2d64(<2 x double> %a) {
117 ; CHECK-LABEL: negv2d64:
118 ; CHECK: # %bb.0: # %entry
119 ; CHECK-NEXT: xvnegdp vs34, vs34
122 %conv = bitcast <2 x double> %a to <2 x i64>
123 %and = xor <2 x i64> %conv, <i64 -9223372036854775808, i64 -9223372036854775808>
124 %conv1 = bitcast <2 x i64> %and to <2 x double>
125 ret <2 x double> %conv1
127 define float @nabsf(float %a) {
128 ; CHECK-LABEL: nabsf:
129 ; CHECK: # %bb.0: # %entry
130 ; CHECK-NEXT: fnabs f1, f1
133 %conv = bitcast float %a to i32
134 %and = or i32 %conv, -2147483648
135 %conv1 = bitcast i32 %and to float
139 define double @nabsd(double %a) {
140 ; CHECK-LABEL: nabsd:
141 ; CHECK: # %bb.0: # %entry
142 ; CHECK-NEXT: xsnabsdp f1, f1
145 %conv = bitcast double %a to i64
146 %and = or i64 %conv, -9223372036854775808
147 %conv1 = bitcast i64 %and to double
151 define <4 x float> @nabsv4f32(<4 x float> %a) {
152 ; CHECK-LABEL: nabsv4f32:
153 ; CHECK: # %bb.0: # %entry
154 ; CHECK-NEXT: xvnabssp vs34, vs34
157 %conv = bitcast <4 x float> %a to <4 x i32>
158 %and = or <4 x i32> %conv, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>
159 %conv1 = bitcast <4 x i32> %and to <4 x float>
160 ret <4 x float> %conv1
163 define <2 x double> @nabsv2d64(<2 x double> %a) {
164 ; CHECK-LABEL: nabsv2d64:
165 ; CHECK: # %bb.0: # %entry
166 ; CHECK-NEXT: xvnabsdp vs34, vs34
169 %conv = bitcast <2 x double> %a to <2 x i64>
170 %and = or <2 x i64> %conv, <i64 -9223372036854775808, i64 -9223372036854775808>
171 %conv1 = bitcast <2 x i64> %and to <2 x double>
172 ret <2 x double> %conv1