File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir -parse-sil %s -module-name Swift -parse-stdlib | %FileCheck %s
2
+
3
+ // This file provides examples on how vector computations are written at the SIL
4
+ // level and how they are translated by IRGen to LLVM IR intrinsics.
5
+
6
+ import Builtin
7
+
8
+ // CHECK-LABEL: define{{( protected)?}} swiftcc <4 x i32> @vector_int_add(<4 x i32>, <4 x i32>) {{.*}} {
9
+ // CHECK-NEXT: entry:
10
+ // CHECK-NEXT: %2 = add <4 x i32> %0, %1
11
+ // CHECK-NEXT: ret <4 x i32> %2
12
+ // CHECK-NEXT: }
13
+ sil @vector_int_add : $@convention(thin) (Builtin.Vec4xInt32, Builtin.Vec4xInt32) -> Builtin.Vec4xInt32 {
14
+ bb0(%0 : $Builtin.Vec4xInt32, %1 : $Builtin.Vec4xInt32):
15
+ %2 = builtin "add_Vec4xInt32" (%0 : $Builtin.Vec4xInt32, %1 : $Builtin.Vec4xInt32) : $Builtin.Vec4xInt32
16
+ return %2 : $Builtin.Vec4xInt32
17
+ }
18
+
19
+ // CHECK-LABEL: define{{( protected)?}} swiftcc <4 x float> @vector_float_add(<4 x float>, <4 x float>) {{.*}} {
20
+ // CHECK-NEXT: entry:
21
+ // CHECK-NEXT: %2 = fadd <4 x float> %0, %1
22
+ // CHECK-NEXT: ret <4 x float> %2
23
+ // CHECK-NEXT: }
24
+ sil @vector_float_add : $@convention(thin) (Builtin.Vec4xFPIEEE32, Builtin.Vec4xFPIEEE32) -> Builtin.Vec4xFPIEEE32 {
25
+ bb0(%0 : $Builtin.Vec4xFPIEEE32, %1 : $Builtin.Vec4xFPIEEE32):
26
+ %2 = builtin "fadd_Vec4xFPIEEE32"(%0 : $Builtin.Vec4xFPIEEE32, %1 : $Builtin.Vec4xFPIEEE32) : $Builtin.Vec4xFPIEEE32
27
+ return %2 : $Builtin.Vec4xFPIEEE32
28
+ }
You can’t perform that action at this time.
0 commit comments