File: assign.fir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • 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 (148 lines) | stat: -rw-r--r-- 7,203 bytes parent folder | download | duplicates (6)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Test hlfir.assign operation parse, verify (no errors), and unparse.

// RUN: fir-opt %s | fir-opt | FileCheck %s

func.func @scalar_logical(%arg0: !fir.ref<!fir.logical<1>>, %arg1: !fir.ref<!fir.logical<1>>) {
  hlfir.assign %arg1 to %arg0 : !fir.ref<!fir.logical<1>>, !fir.ref<!fir.logical<1>>
  return
}
// CHECK-LABEL:   func.func @scalar_logical(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.logical<1>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.ref<!fir.logical<1>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.ref<!fir.logical<1>>, !fir.ref<!fir.logical<1>>

func.func @scalar_logical_2(%arg0: !fir.ref<!fir.logical<1>>, %arg1: i1) {
  hlfir.assign %arg1 to %arg0 : i1, !fir.ref<!fir.logical<1>>
  return
}
// CHECK-LABEL:   func.func @scalar_logical_2(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.logical<1>>,
// CHECK-SAME:    %[[VAL_1:.*]]: i1) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : i1, !fir.ref<!fir.logical<1>>

func.func @scalar_integer(%arg0: !fir.ref<i32>, %arg1: !fir.ref<i32>) {
  hlfir.assign %arg1 to %arg0 : !fir.ref<i32>, !fir.ref<i32>
  return
}
// CHECK-LABEL:   func.func @scalar_integer(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<i32>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.ref<i32>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.ref<i32>, !fir.ref<i32>

func.func @scalar_integer_2(%arg0: !fir.ref<i32>, %arg1: i32) {
  hlfir.assign %arg1 to %arg0 : i32, !fir.ref<i32>
  return
}
// CHECK-LABEL:   func.func @scalar_integer_2(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<i32>,
// CHECK-SAME:    %[[VAL_1:.*]]: i32) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : i32, !fir.ref<i32>

func.func @scalar_real(%arg0: !fir.ref<f16>, %arg1: !fir.ref<f16>) {
  hlfir.assign %arg1 to %arg0 : !fir.ref<f16>, !fir.ref<f16>
  return
}
// CHECK-LABEL:   func.func @scalar_real(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<f16>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.ref<f16>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.ref<f16>, !fir.ref<f16>

func.func @scalar_complex(%arg0: !fir.ref<!fir.complex<8>>, %arg1: !fir.ref<!fir.complex<8>>) {
  hlfir.assign %arg1 to %arg0 : !fir.ref<!fir.complex<8>>, !fir.ref<!fir.complex<8>>
  return
}
// CHECK-LABEL:   func.func @scalar_complex(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.complex<8>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.ref<!fir.complex<8>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.ref<!fir.complex<8>>, !fir.ref<!fir.complex<8>>

func.func @scalar_complex_2(%arg0: !fir.ref<!fir.complex<8>>, %arg1: !fir.complex<8>) {
  hlfir.assign %arg1 to %arg0 : !fir.complex<8>, !fir.ref<!fir.complex<8>>
  return
}
// CHECK-LABEL:   func.func @scalar_complex_2(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.complex<8>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.complex<8>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.complex<8>, !fir.ref<!fir.complex<8>>


func.func @scalar_character(%arg0: !fir.boxchar<1>, %arg1: !fir.boxchar<1>) {
  hlfir.assign %arg1 to %arg0 : !fir.boxchar<1>, !fir.boxchar<1>
  return
}
// CHECK-LABEL:   func.func @scalar_character(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.boxchar<1>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.boxchar<1>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.boxchar<1>, !fir.boxchar<1>

func.func @scalar_character_2(%arg0: !fir.ref<!fir.char<1,32>>, %arg1: !fir.ref<!fir.char<1,64>>) {
  hlfir.assign %arg1 to %arg0 : !fir.ref<!fir.char<1,64>>, !fir.ref<!fir.char<1,32>>
  return
}
// CHECK-LABEL:   func.func @scalar_character_2(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.char<1,32>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.ref<!fir.char<1,64>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.ref<!fir.char<1,64>>, !fir.ref<!fir.char<1,32>>

func.func @scalar_character_3(%arg0: !fir.boxchar<1>, %arg1: !hlfir.expr<!fir.char<1,?>>) {
  hlfir.assign %arg1 to %arg0 : !hlfir.expr<!fir.char<1,?>>, !fir.boxchar<1>
  return
}
// CHECK-LABEL:   func.func @scalar_character_3(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.boxchar<1>,
// CHECK-SAME:    %[[VAL_1:.*]]: !hlfir.expr<!fir.char<1,?>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !hlfir.expr<!fir.char<1,?>>, !fir.boxchar<1>

func.func @array(%arg0: !fir.ref<!fir.array<10xi32>>, %arg1: i32) {
  hlfir.assign %arg1 to %arg0 : i32, !fir.ref<!fir.array<10xi32>>
  return
}
// CHECK-LABEL:   func.func @array(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.array<10xi32>>,
// CHECK-SAME:    %[[VAL_1:.*]]: i32) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : i32, !fir.ref<!fir.array<10xi32>>

func.func @array_2(%arg0: !fir.ref<!fir.array<10xi32>>, %arg1: !hlfir.expr<?xi32>) {
  hlfir.assign %arg1 to %arg0 : !hlfir.expr<?xi32>, !fir.ref<!fir.array<10xi32>>
  return
}
// CHECK-LABEL:   func.func @array_2(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.array<10xi32>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !hlfir.expr<?xi32>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !hlfir.expr<?xi32>, !fir.ref<!fir.array<10xi32>>

func.func @array_3(%arg0: !fir.box<!fir.array<?xi32>>, %arg1: !hlfir.expr<?xi32>) {
  hlfir.assign %arg1 to %arg0 : !hlfir.expr<?xi32>, !fir.box<!fir.array<?xi32>>
  return
}
// CHECK-LABEL:   func.func @array_3(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.box<!fir.array<?xi32>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !hlfir.expr<?xi32>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !hlfir.expr<?xi32>, !fir.box<!fir.array<?xi32>>

func.func @array_4(%arg0: !fir.box<!fir.array<?xi32>>, %arg1: !fir.box<!fir.array<?xi32>>) {
  hlfir.assign %arg1 to %arg0 : !fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>
  return
}
// CHECK-LABEL:   func.func @array_4(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.box<!fir.array<?xi32>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.box<!fir.array<?xi32>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] : !fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>

func.func @alloc_assign(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %arg1: !fir.box<!fir.array<?xi32>>) {
  hlfir.assign %arg1 to %arg0 realloc : !fir.box<!fir.array<?xi32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
  return
}
// CHECK-LABEL:   func.func @alloc_assign(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.box<!fir.array<?xi32>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] realloc : !fir.box<!fir.array<?xi32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>

func.func @alloc_assign_keep_lhs_len(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>, %arg1: !fir.box<!fir.array<?x!fir.char<1,?>>>) {
  hlfir.assign %arg1 to %arg0 realloc keep_lhs_len : !fir.box<!fir.array<?x!fir.char<1,?>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
  return
}
// CHECK-LABEL:   func.func @alloc_assign_keep_lhs_len(
// CHECK-SAME:    %[[VAL_0:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>,
// CHECK-SAME:    %[[VAL_1:.*]]: !fir.box<!fir.array<?x!fir.char<1,?>>>) {
// CHECK:  hlfir.assign %[[VAL_1]] to %[[VAL_0]] realloc keep_lhs_len : !fir.box<!fir.array<?x!fir.char<1,?>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>