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: xsabsdp 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: lxvd2x vs0, 0, r3
59 ; CHECK-NEXT: xxswapd vs35, vs0
60 ; CHECK-NEXT: xxland vs34, vs34, vs35
63 %conv = bitcast <4 x float> %a to <4 x i32>
64 %and = and <4 x i32> %conv, <i32 2147483646, i32 2147483647, i32 2147483647, i32 2147483647>
65 %conv1 = bitcast <4 x i32> %and to <4 x float>
66 ret <4 x float> %conv1
69 define <2 x double> @absv2f64(<2 x double> %a) {
70 ; CHECK-LABEL: absv2f64:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: xvabsdp vs34, vs34
75 %conv = bitcast <2 x double> %a to <2 x i64>
76 %and = and <2 x i64> %conv, <i64 9223372036854775807, i64 9223372036854775807>
77 %conv1 = bitcast <2 x i64> %and to <2 x double>
78 ret <2 x double> %conv1
81 define float @negf(float %a) {
83 ; CHECK: # %bb.0: # %entry
84 ; CHECK-NEXT: xsnegdp f1, f1
87 %conv = bitcast float %a to i32
88 %and = xor i32 %conv, -2147483648
89 %conv1 = bitcast i32 %and to float
93 define double @negd(double %a) {
95 ; CHECK: # %bb.0: # %entry
96 ; CHECK-NEXT: xsnegdp f1, f1
99 %conv = bitcast double %a to i64
100 %and = xor i64 %conv, -9223372036854775808
101 %conv1 = bitcast i64 %and to double
105 define <4 x float> @negv4f32(<4 x float> %a) {
106 ; CHECK-LABEL: negv4f32:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK-NEXT: xvnegsp vs34, vs34
111 %conv = bitcast <4 x float> %a to <4 x i32>
112 %and = xor <4 x i32> %conv, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>
113 %conv1 = bitcast <4 x i32> %and to <4 x float>
114 ret <4 x float> %conv1
117 define <2 x double> @negv2d64(<2 x double> %a) {
118 ; CHECK-LABEL: negv2d64:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: xvnegdp vs34, vs34
123 %conv = bitcast <2 x double> %a to <2 x i64>
124 %and = xor <2 x i64> %conv, <i64 -9223372036854775808, i64 -9223372036854775808>
125 %conv1 = bitcast <2 x i64> %and to <2 x double>
126 ret <2 x double> %conv1
128 define float @nabsf(float %a) {
129 ; CHECK-LABEL: nabsf:
130 ; CHECK: # %bb.0: # %entry
131 ; CHECK-NEXT: xsnabsdp f1, f1
134 %conv = bitcast float %a to i32
135 %and = or i32 %conv, -2147483648
136 %conv1 = bitcast i32 %and to float
140 define double @nabsd(double %a) {
141 ; CHECK-LABEL: nabsd:
142 ; CHECK: # %bb.0: # %entry
143 ; CHECK-NEXT: xsnabsdp f1, f1
146 %conv = bitcast double %a to i64
147 %and = or i64 %conv, -9223372036854775808
148 %conv1 = bitcast i64 %and to double
152 define <4 x float> @nabsv4f32(<4 x float> %a) {
153 ; CHECK-LABEL: nabsv4f32:
154 ; CHECK: # %bb.0: # %entry
155 ; CHECK-NEXT: xvnabssp vs34, vs34
158 %conv = bitcast <4 x float> %a to <4 x i32>
159 %and = or <4 x i32> %conv, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>
160 %conv1 = bitcast <4 x i32> %and to <4 x float>
161 ret <4 x float> %conv1
164 define <2 x double> @nabsv2d64(<2 x double> %a) {
165 ; CHECK-LABEL: nabsv2d64:
166 ; CHECK: # %bb.0: # %entry
167 ; CHECK-NEXT: xvnabsdp vs34, vs34
170 %conv = bitcast <2 x double> %a to <2 x i64>
171 %and = or <2 x i64> %conv, <i64 -9223372036854775808, i64 -9223372036854775808>
172 %conv1 = bitcast <2 x i64> %and to <2 x double>
173 ret <2 x double> %conv1