llvm.org GIT mirror llvm / c83b5dc
PowerPC: Expand FSRQT for vector types This patch expands FSQRT for floating point vector types when altivec is used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167034 91177308-0d34-0410-b5e6-96231b3b80d8 Adhemerval Zanella 7 years ago
2 changed file(s) with 77 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
360360 setOperationAction(ISD::CTLZ_ZERO_UNDEF, VT, Expand);
361361 setOperationAction(ISD::CTTZ, VT, Expand);
362362 setOperationAction(ISD::CTTZ_ZERO_UNDEF, VT, Expand);
363 }
364
365 for (unsigned i = (unsigned)MVT::FIRST_FP_VECTOR_VALUETYPE;
366 i <= (unsigned)MVT::LAST_FP_VECTOR_VALUETYPE; ++i) {
367 MVT::SimpleValueType VT = (MVT::SimpleValueType)i;
368 setOperationAction(ISD::FSQRT, VT, Expand);
363369 }
364370
365371 // We can custom expand all VECTOR_SHUFFLEs to VPERM, others we can handle
0 ; RUN: llc -mcpu=pwr6 -mattr=+altivec,+fsqrt < %s | FileCheck %s
1
2 ; Check for vector sqrt expansion using floating-point types, since altivec
3 ; does not provide an fsqrt instruction for vector.
4
5 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"
6 target triple = "powerpc64-unknown-linux-gnu"
7
8 declare <2 x float> @llvm.sqrt.v2f32(<2 x float> %val)
9 declare <4 x float> @llvm.sqrt.v4f32(<4 x float> %val)
10 declare <8 x float> @llvm.sqrt.v8f32(<8 x float> %val)
11 declare <2 x double> @llvm.sqrt.v2f64(<2 x double> %val)
12 declare <4 x double> @llvm.sqrt.v4f64(<4 x double> %val)
13
14 define <2 x float> @v2f32_sqrt(<2 x float> %x) nounwind readnone {
15 entry:
16 %sqrt = call <2 x float> @llvm.sqrt.v2f32 (<2 x float> %x)
17 ret <2 x float> %sqrt
18 }
19 ; sqrt (<2 x float>) is promoted to sqrt (<4 x float>)
20 ; CHECK: v2f32_sqrt:
21 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
22 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
23 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
24 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
25
26 define <4 x float> @v4f32_sqrt(<4 x float> %x) nounwind readnone {
27 entry:
28 %sqrt = call <4 x float> @llvm.sqrt.v4f32 (<4 x float> %x)
29 ret <4 x float> %sqrt
30 }
31 ; CHECK: v4f32_sqrt:
32 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
33 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
34 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
35 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
36
37 define <8 x float> @v8f32_sqrt(<8 x float> %x) nounwind readnone {
38 entry:
39 %sqrt = call <8 x float> @llvm.sqrt.v8f32 (<8 x float> %x)
40 ret <8 x float> %sqrt
41 }
42 ; CHECK: v8f32_sqrt:
43 ; CHECK: fsqrts {{[0-9]+}}, {{[0-9]+}}
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
52 define <2 x double> @v2f64_sqrt(<2 x double> %x) nounwind readnone {
53 entry:
54 %sqrt = call <2 x double> @llvm.sqrt.v2f64 (<2 x double> %x)
55 ret <2 x double> %sqrt
56 }
57 ; CHECK: v2f64_sqrt:
58 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
59 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
60
61 define <4 x double> @v4f64_sqrt(<4 x double> %x) nounwind readnone {
62 entry:
63 %sqrt = call <4 x double> @llvm.sqrt.v4f64 (<4 x double> %x)
64 ret <4 x double> %sqrt
65 }
66 ; CHECK: v4f64_sqrt:
67 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
68 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
69 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}
70 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}}