1 ; RUN: llc -verify-machineinstrs -mcpu=pwr6 -mattr=+altivec,+fsqrt < %s | FileCheck %s 2 3 ; Check for vector sqrt expansion using floating-point types, since altivec 4 ; does not provide an fsqrt instruction for vector. 5 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" 8 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) 14 15 define <2 x float> @v2f32_sqrt(<2 x float> %x) nounwind readnone { 16 entry: 17 %sqrt = call <2 x float> @llvm.sqrt.v2f32 (<2 x float> %x) 18 ret <2 x float> %sqrt 19 } 20 ; sqrt (<2 x float>) is promoted to sqrt (<4 x float>) 21 ; CHECK-LABEL: v2f32_sqrt: 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]+}} 26 27 define <4 x float> @v4f32_sqrt(<4 x float> %x) nounwind readnone { 28 entry: 29 %sqrt = call <4 x float> @llvm.sqrt.v4f32 (<4 x float> %x) 30 ret <4 x float> %sqrt 31 } 32 ; CHECK-LABEL: v4f32_sqrt: 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]+}} 37 38 define <8 x float> @v8f32_sqrt(<8 x float> %x) nounwind readnone { 39 entry: 40 %sqrt = call <8 x float> @llvm.sqrt.v8f32 (<8 x float> %x) 41 ret <8 x float> %sqrt 42 } 43 ; CHECK-LABEL: v8f32_sqrt: 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]+}} 52 53 define <2 x double> @v2f64_sqrt(<2 x double> %x) nounwind readnone { 54 entry: 55 %sqrt = call <2 x double> @llvm.sqrt.v2f64 (<2 x double> %x) 56 ret <2 x double> %sqrt 57 } 58 ; CHECK-LABEL: v2f64_sqrt: 59 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}} 60 ; CHECK: fsqrt {{[0-9]+}}, {{[0-9]+}} 61 62 define <4 x double> @v4f64_sqrt(<4 x double> %x) nounwind readnone { 63 entry: 64 %sqrt = call <4 x double> @llvm.sqrt.v4f64 (<4 x double> %x) 65 ret <4 x double> %sqrt 66 } 67 ; CHECK-LABEL: v4f64_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]+}} 72