mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
82 lines
5.4 KiB
Plaintext
82 lines
5.4 KiB
Plaintext
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | %FileCheck %s --check-prefix=%target-cpu
|
|
|
|
import Swift
|
|
import simd
|
|
|
|
// Work around rdar://problem/20577079 with a Swift function that touches all
|
|
// the fields of float4, forcing it to be validated.
|
|
func forceStuff(x: float4, y: float3) -> (Float, Float, Float, Float) {
|
|
if true {
|
|
return (y.x, y.y, y.z, y.x)
|
|
} else {
|
|
return (x.x, x.y, x.z, x.w)
|
|
}
|
|
}
|
|
|
|
// x86_64-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// i386-LABEL: define{{( protected)?}} <2 x i64> @simd_c_args(<4 x float>)
|
|
// arm64-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// armv6-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// armv7-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// armv7s-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// armv7k-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// powerpc64-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// powerpc64le-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
// s390x-LABEL: define{{( protected)?}} <4 x float> @simd_c_args(<4 x float>)
|
|
sil @simd_c_args : $@convention(c) (float4) -> float4 {
|
|
entry(%x : $float4):
|
|
return %x : $float4
|
|
}
|
|
|
|
// x86_64-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float>)
|
|
// i386-LABEL: define{{( protected)?}} <2 x i64> @simd_c_args_float3(<3 x float>)
|
|
// arm64-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32>)
|
|
// armv6-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32>)
|
|
// armv7-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32>)
|
|
// armv7s-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32>)
|
|
// armv7k-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32>)
|
|
// powerpc64-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float>)
|
|
// powerpc64le-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float>)
|
|
// s390x-LABEL: define{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float>)
|
|
sil @simd_c_args_float3 : $@convention(c) (float3) -> float3 {
|
|
entry(%x : $float3):
|
|
// x86_64: [[COERCE:%.*]] = alloca <3 x float>, align 16
|
|
// x86_64: store <3 x float> %0, <3 x float>* [[COERCE]]
|
|
// x86_64: [[COERCED:%.*]] = bitcast <3 x float>* [[COERCE]] to %T4simd6float3V*
|
|
return %x : $float3
|
|
}
|
|
|
|
// x86_64-LABEL: define{{( protected)?}} swiftcc { i64, i64 } @simd_native_args(i64, i64)
|
|
// i386-LABEL: define{{( protected)?}} swiftcc void @simd_native_args(%T4simd6float4V* noalias nocapture sret, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}))
|
|
// arm64-LABEL: define{{( protected)?}} swiftcc { i64, i64 } @simd_native_args(i64, i64)
|
|
// armv6-LABEL: define{{( protected)?}} swiftcc void @simd_native_args(%T4simd6float4V* noalias nocapture sret, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}))
|
|
// armv7-LABEL: define{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float, float, float, float)
|
|
// armv7s-LABEL: define{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float, float, float, float)
|
|
// armv7k-LABEL: define{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float, float, float, float)
|
|
// powerpc64-LABEL: define{{( protected)?}} void @simd_native_args(%T4simd6float4V* noalias nocapture sret, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}))
|
|
// powerpc64le-LABEL: define{{( protected)?}} void @simd_native_args(%T4simd6float4V* noalias nocapture sret, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}))
|
|
// s390x-LABEL: define{{( protected)?}} void @simd_native_args(%T4simd6float4V* noalias nocapture sret, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}))
|
|
sil @simd_native_args : $@convention(thin) (float4) -> float4 {
|
|
entry(%x : $float4):
|
|
%f = function_ref @simd_c_args : $@convention(c) (float4) -> float4
|
|
%y = apply %f(%x) : $@convention(c) (float4) -> float4
|
|
return %y : $float4
|
|
}
|
|
|
|
// x86_64-LABEL: define{{( protected)?}} swiftcc { i64, float } @simd_native_args_float3(i64, float)
|
|
// i386-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// arm64-LABEL: define{{( protected)?}} swiftcc { i64, float } @simd_native_args_float3(i64, float)
|
|
// armv6-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// armv7-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// armv7s-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// armv7k-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// powerpc64-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// powerpc64le-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
// s390x-LABEL: define{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float, float, float)
|
|
sil @simd_native_args_float3 : $@convention(thin) (float3) -> float3 {
|
|
entry(%x : $float3):
|
|
%f = function_ref @simd_c_args_float3 : $@convention(c) (float3) -> float3
|
|
%y = apply %f(%x) : $@convention(c) (float3) -> float3
|
|
return %y : $float3
|
|
}
|