blob: 827d4184d111bbc6c27a4c9b471e162cc2c38d8a [file] [log] [blame]
Sanjay Patel75cc90e2014-09-05 22:26:22 +00001; RUN: llc < %s -enable-unsafe-fp-math -mtriple=x86_64-unknown-unknown -mcpu=corei7 | FileCheck %s
2
3; Make sure that vectors get the same benefits as scalars when using unsafe-fp-math.
4
5; Subtracting zero is free.
6define <4 x float> @vec_fsub_zero(<4 x float> %x) {
7; CHECK-LABEL: vec_fsub_zero:
8; CHECK-NOT: subps
9; CHECK-NOT: xorps
10; CHECK: retq
11 %sub = fsub <4 x float> %x, zeroinitializer
12 ret <4 x float> %sub
13}
14
15; Negating doesn't require subtraction.
16define <4 x float> @vec_fneg(<4 x float> %x) {
17; CHECK-LABEL: vec_fneg:
18; CHECK: xorps {{.*}}LCP{{.*}}, %xmm0
19; CHECK-NOT: subps
20; CHECK-NEXT: retq
21 %sub = fsub <4 x float> zeroinitializer, %x
22 ret <4 x float> %sub
23}