File: apply.fir

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 (42 lines) | stat: -rw-r--r-- 2,149 bytes parent folder | download | duplicates (14)
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
// Test hlfir.apply operation parse, verify (no errors), and unparse.

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

func.func @numeric(%expr: !hlfir.expr<?x?xf32>) {
  %c9 = arith.constant 9 : index
  %c2 = arith.constant 2 : index
  %0 = hlfir.apply %expr, %c9, %c2 : (!hlfir.expr<?x?xf32>, index, index) -> f32
  return
}
// CHECK-LABEL:   func.func @numeric(
// CHECK-SAME:    %[[VAL_0:.*]]: !hlfir.expr<?x?xf32>) {
// CHECK:  %[[VAL_1:.*]] = arith.constant 9 : index
// CHECK:  %[[VAL_2:.*]] = arith.constant 2 : index
// CHECK:  %[[VAL_3:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_1]], %[[VAL_2]] : (!hlfir.expr<?x?xf32>, index, index) -> f32

func.func @char(%expr: !hlfir.expr<?x?x!fir.char<1,?>>, %l: index) {
  %c9 = arith.constant 9 : index
  %c2 = arith.constant 2 : index
  %0 = hlfir.apply %expr, %c9, %c2 typeparams %l: (!hlfir.expr<?x?x!fir.char<1,?>>, index, index, index) -> !hlfir.expr<!fir.char<1,?>>
  return
}
// CHECK-LABEL:   func.func @char(
// CHECK-SAME:    %[[VAL_0:.*]]: !hlfir.expr<?x?x!fir.char<1,?>>,
// CHECK-SAME:    %[[VAL_1:.*]]: index) {
// CHECK:  %[[VAL_2:.*]] = arith.constant 9 : index
// CHECK:  %[[VAL_3:.*]] = arith.constant 2 : index
// CHECK:  %[[VAL_4:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_2]], %[[VAL_3]] typeparams %[[VAL_1]] : (!hlfir.expr<?x?x!fir.char<1,?>>, index, index, index) -> !hlfir.expr<!fir.char<1,?>>

!pdt = !fir.type<pdt(param:i32){field:f32}>
func.func @derived(%expr: !hlfir.expr<?x?x!pdt>, %l: i32) {
  %c9 = arith.constant 9 : index
  %c2 = arith.constant 2 : index
  %0 = hlfir.apply %expr, %c9, %c2 typeparams %l: (!hlfir.expr<?x?x!pdt>, index, index, i32) -> !hlfir.expr<!pdt>
  return
}
// CHECK-LABEL:   func.func @derived(
// CHECK-SAME:    %[[VAL_0:.*]]: !hlfir.expr<?x?x!fir.type<pdt(param:i32){field:f32}>>,
// CHECK-SAME:    %[[VAL_1:.*]]: i32) {
// CHECK:  %[[VAL_2:.*]] = arith.constant 9 : index
// CHECK:  %[[VAL_3:.*]] = arith.constant 2 : index
// CHECK:  %[[VAL_4:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_2]], %[[VAL_3]] typeparams %[[VAL_1]] : (!hlfir.expr<?x?x!fir.type<pdt(param:i32){field:f32}>>, index, index, i32) -> !hlfir.expr<!fir.type<pdt(param:i32){field:f32}>>