File: polymorphic_builtins.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (54 lines) | stat: -rw-r--r-- 2,755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// RUN: %target-sil-opt -module-name Swift -diagnostic-constant-propagation %s | %FileCheck %s

sil_stage raw

import Builtin

struct MyInt {
  var i : Builtin.Int32
}

// CHECK-LABEL: sil @concrete_type_object_test : $@convention(thin) (Builtin.Vec4xInt32, Builtin.Vec4xInt32) -> Builtin.Vec4xInt32 {
// CHECK: builtin "add_Vec4xInt32"(
// CHECK: return
// CHECK: } // end sil function 'concrete_type_object_test'
sil @concrete_type_object_test : $@convention(thin) (Builtin.Vec4xInt32, Builtin.Vec4xInt32) -> Builtin.Vec4xInt32 {
bb0(%0 : $Builtin.Vec4xInt32, %1 : $Builtin.Vec4xInt32):
  %2 = builtin "generic_add"(%0 : $Builtin.Vec4xInt32, %1 : $Builtin.Vec4xInt32) : $Builtin.Vec4xInt32
  return %2 : $Builtin.Vec4xInt32
}

// CHECK-LABEL: sil @concrete_type_address_test : $@convention(thin) (@in_guaranteed Builtin.Vec4xInt32, @in_guaranteed Builtin.Vec4xInt32) -> @out Builtin.Vec4xInt32 {
// CHECK: bb0([[RESULT:%.*]] : $*Builtin.Vec4xInt32, [[ARG0:%.*]] : $*Builtin.Vec4xInt32, [[ARG1:%.*]] : $*Builtin.Vec4xInt32):
// CHECK:   [[LOADED_ARG0:%.*]] = load [[ARG0]]
// CHECK:   [[LOADED_ARG1:%.*]] = load [[ARG1]]
// CHECK:   [[LOADED_RESULT:%.*]] = builtin "add_Vec4xInt32"([[LOADED_ARG0]] : $Builtin.Vec4xInt32, [[LOADED_ARG1]] : $Builtin.Vec4xInt32) : $Builtin.Vec4xInt32
// CHECK:   store [[LOADED_RESULT]] to [[RESULT]]
// CHECK: } // end sil function 'concrete_type_address_test'
sil @concrete_type_address_test : $@convention(thin) (@in_guaranteed Builtin.Vec4xInt32, @in_guaranteed Builtin.Vec4xInt32) -> @out Builtin.Vec4xInt32 {
bb0(%0 : $*Builtin.Vec4xInt32, %1 : $*Builtin.Vec4xInt32, %2 : $*Builtin.Vec4xInt32):
  builtin "generic_add"<Builtin.Vec4xInt32>(%0 : $*Builtin.Vec4xInt32, %1 : $*Builtin.Vec4xInt32, %2 : $*Builtin.Vec4xInt32) : $()
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil @concrete_type_object_fail : $@convention(thin) (MyInt, MyInt) -> MyInt {
// CHECK: builtin "generic_add"<MyInt>(
// CHECK: return
// CHECK: } // end sil function 'concrete_type_object_fail'
sil @concrete_type_object_fail : $@convention(thin) (MyInt, MyInt) -> MyInt {
bb0(%0 : $MyInt, %1 : $MyInt):
  %2 = builtin "generic_add"<MyInt>(%0 : $MyInt, %1 : $MyInt) : $MyInt
  return %2 : $MyInt
}

// CHECK-LABEL: sil @concrete_type_address_fail : $@convention(thin) (@in_guaranteed MyInt, @in_guaranteed MyInt) -> @out MyInt {
// CHECK: builtin "generic_add"<MyInt>(
// CHECK: return
// CHECK: } // end sil function 'concrete_type_address_fail'
sil @concrete_type_address_fail : $@convention(thin) (@in_guaranteed MyInt, @in_guaranteed MyInt) -> @out MyInt {
bb0(%0 : $*MyInt, %1 : $*MyInt, %2 : $*MyInt):
  %3 = builtin "generic_add"<MyInt>(%0 : $*MyInt, %1 : $*MyInt, %2 : $*MyInt) : $()
  %9999 = tuple()
  return %9999 : $()
}