1 ; RUN: llc -mcpu=pwr6 -mattr=+altivec,+fsqrt < %s | FileCheck %s
3 ; Check for vector sqrt expansion using floating-point types, since altivec
4 ; does not provide an fsqrt instruction for vector.
6 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
7 target triple = "powerpc64-unknown-linux-gnu"
9 declare <2 x float> @llvm.sqrt.v2f32(<2 x float> %val)
10 declare <4 x float> @llvm.sqrt.v4f32(<4 x float> %val)
11 declare <8 x float> @llvm.sqrt.v8f32(<8 x float> %val)
12 declare <2 x double> @llvm.sqrt.v2f64(<2 x double> %val)
13 declare <4 x double> @llvm.sqrt.v4f64(<4 x double> %val)
15 define <2 x float> @v2f32_sqrt(<2 x float> %x) nounwind readnone {
17 %sqrt = call <2 x float> @llvm.sqrt.v2f32 (<2 x float> %x)
20 ; sqrt (<2 x float>) is promoted to sqrt (<4 x float>)
22 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
23 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
24 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
25 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
27 define <4 x float> @v4f32_sqrt(<4 x float> %x) nounwind readnone {
29 %sqrt = call <4 x float> @llvm.sqrt.v4f32 (<4 x float> %x)
33 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
34 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
35 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
36 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
38 define <8 x float> @v8f32_sqrt(<8 x float> %x) nounwind readnone {
40 %sqrt = call <8 x float> @llvm.sqrt.v8f32 (<8 x float> %x)
44 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
45 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
46 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
47 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
48 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
49 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
50 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
51 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
53 define <2 x double> @v2f64_sqrt(<2 x double> %x) nounwind readnone {
55 %sqrt = call <2 x double> @llvm.sqrt.v2f64 (<2 x double> %x)
56 ret <2 x double> %sqrt
59 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
60 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
62 define <4 x double> @v4f64_sqrt(<4 x double> %x) nounwind readnone {
64 %sqrt = call <4 x double> @llvm.sqrt.v4f64 (<4 x double> %x)
65 ret <4 x double> %sqrt
68 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
69 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
70 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
71 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}