Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -O1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
      2 
      3 #include <arm_neon.h>
      4 
      5 float64x2_t test_vcvt_f64_f32(float32x2_t x) {
      6   // CHECK-LABEL: test_vcvt_f64_f32
      7   return vcvt_f64_f32(x);
      8   // CHECK: fpext <2 x float> {{%.*}} to <2 x double>
      9   // CHECK-NEXT: ret
     10 }
     11 
     12 float64x2_t test_vcvt_high_f64_f32(float32x4_t x) {
     13   // CHECK-LABEL: test_vcvt_high_f64_f32
     14   return vcvt_high_f64_f32(x);
     15   // CHECK: [[HIGH:%.*]] = shufflevector <4 x float> {{%.*}}, <4 x float> undef, <2 x i32> <i32 2, i32 3>
     16   // CHECK-NEXT: fpext <2 x float> [[HIGH]] to <2 x double>
     17   // CHECK-NEXT: ret
     18 }
     19 
     20 float32x2_t test_vcvt_f32_f64(float64x2_t v) {
     21   // CHECK: test_vcvt_f32_f64
     22   return vcvt_f32_f64(v);
     23   // CHECK: fptrunc <2 x double> {{%.*}} to <2 x float>
     24   // CHECK-NEXT: ret
     25 }
     26 
     27 float32x4_t test_vcvt_high_f32_f64(float32x2_t x, float64x2_t v) {
     28   // CHECK: test_vcvt_high_f32_f64
     29   return vcvt_high_f32_f64(x, v);
     30   // CHECK: [[TRUNC:%.*]] = fptrunc <2 x double> {{.*}} to <2 x float>
     31   // CHECK-NEXT: shufflevector <2 x float> {{.*}}, <2 x float> [[TRUNC]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
     32   // CHECK-NEXT: ret
     33 }
     34 
     35 float32x2_t test_vcvtx_f32_f64(float64x2_t v) {
     36   // CHECK: test_vcvtx_f32_f64
     37   return vcvtx_f32_f64(v);
     38   // CHECK: llvm.aarch64.neon.fcvtxn.v2f32.v2f64
     39   // CHECK-NEXT: ret
     40 }
     41 
     42 float32x4_t test_vcvtx_high_f32_f64(float32x2_t x, float64x2_t v) {
     43   // CHECK: test_vcvtx_high_f32_f64
     44   return vcvtx_high_f32_f64(x, v);
     45   // CHECK: llvm.aarch64.neon.fcvtxn.v2f32.v2f64
     46   // CHECK: shufflevector
     47   // CHECK: ret
     48 }
     49