| 1 |
// RUN: fir-opt -split-input-file --omp-function-filtering %s | FileCheck %s |
| 2 |
|
| 3 |
// CHECK: func.func @any |
| 4 |
// CHECK: return |
| 5 |
// CHECK: func.func @nohost |
| 6 |
// CHECK: return |
| 7 |
// CHECK-NOT: func.func {{.*}}}} @host |
| 8 |
// CHECK-NOT: func.func {{.*}}}} @none |
| 9 |
// CHECK: func.func @nohost_target |
| 10 |
// CHECK: return |
| 11 |
// CHECK: func.func @host_target |
| 12 |
// CHECK: return |
| 13 |
// CHECK: func.func @none_target |
| 14 |
// CHECK: return |
| 15 |
// CHECK: func.func @host_target_call |
| 16 |
// CHECK-NOT: call @none_target |
| 17 |
// CHECK: %[[UNDEF:.*]] = fir.undefined i32 |
| 18 |
// CHECK: return %[[UNDEF]] : i32 |
| 19 |
module attributes {omp.is_target_device = true} { |
| 20 |
func.func @any() -> () |
| 21 |
attributes { |
| 22 |
omp.declare_target = |
| 23 |
#omp.declaretarget<device_type = (any), capture_clause = (to)> |
| 24 |
} { |
| 25 |
func.return |
| 26 |
} |
| 27 |
func.func @nohost() -> () |
| 28 |
attributes { |
| 29 |
omp.declare_target = |
| 30 |
#omp.declaretarget<device_type = (nohost), capture_clause = (to)> |
| 31 |
} { |
| 32 |
func.return |
| 33 |
} |
| 34 |
func.func @host() -> () |
| 35 |
attributes { |
| 36 |
omp.declare_target = |
| 37 |
#omp.declaretarget<device_type = (host), capture_clause = (to)> |
| 38 |
} { |
| 39 |
func.return |
| 40 |
} |
| 41 |
func.func @none() -> () { |
| 42 |
func.return |
| 43 |
} |
| 44 |
func.func @nohost_target() -> () |
| 45 |
attributes { |
| 46 |
omp.declare_target = |
| 47 |
#omp.declaretarget<device_type = (nohost), capture_clause = (to)> |
| 48 |
} { |
| 49 |
omp.target {} |
| 50 |
func.return |
| 51 |
} |
| 52 |
func.func @host_target() -> () |
| 53 |
attributes { |
| 54 |
omp.declare_target = |
| 55 |
#omp.declaretarget<device_type = (host), capture_clause = (to)> |
| 56 |
} { |
| 57 |
omp.target {} |
| 58 |
func.return |
| 59 |
} |
| 60 |
func.func @none_target() -> i32 { |
| 61 |
omp.target {} |
| 62 |
%0 = arith.constant 25 : i32 |
| 63 |
func.return %0 : i32 |
| 64 |
} |
| 65 |
func.func @host_target_call() -> i32 |
| 66 |
attributes { |
| 67 |
omp.declare_target = |
| 68 |
#omp.declaretarget<device_type = (host), capture_clause = (to)> |
| 69 |
} { |
| 70 |
omp.target {} |
| 71 |
%0 = call @none_target() : () -> i32 |
| 72 |
func.return %0 : i32 |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
// ----- |
| 77 |
|
| 78 |
// CHECK: func.func @any |
| 79 |
// CHECK: return |
| 80 |
// CHECK: func.func @nohost |
| 81 |
// CHECK: return |
| 82 |
// CHECK: func.func @host |
| 83 |
// CHECK: return |
| 84 |
// CHECK: func.func @none |
| 85 |
// CHECK: return |
| 86 |
// CHECK: func.func @nohost_target |
| 87 |
// CHECK: return |
| 88 |
// CHECK: func.func @host_target |
| 89 |
// CHECK: return |
| 90 |
// CHECK: func.func @none_target |
| 91 |
// CHECK: return |
| 92 |
module attributes {omp.is_target_device = false} { |
| 93 |
func.func @any() -> () |
| 94 |
attributes { |
| 95 |
omp.declare_target = |
| 96 |
#omp.declaretarget<device_type = (any), capture_clause = (to)> |
| 97 |
} { |
| 98 |
func.return |
| 99 |
} |
| 100 |
func.func @nohost() -> () |
| 101 |
attributes { |
| 102 |
omp.declare_target = |
| 103 |
#omp.declaretarget<device_type = (nohost), capture_clause = (to)> |
| 104 |
} { |
| 105 |
func.return |
| 106 |
} |
| 107 |
func.func @host() -> () |
| 108 |
attributes { |
| 109 |
omp.declare_target = |
| 110 |
#omp.declaretarget<device_type = (host), capture_clause = (to)> |
| 111 |
} { |
| 112 |
func.return |
| 113 |
} |
| 114 |
func.func @none() -> () { |
| 115 |
func.return |
| 116 |
} |
| 117 |
func.func @nohost_target() -> () |
| 118 |
attributes { |
| 119 |
omp.declare_target = |
| 120 |
#omp.declaretarget<device_type = (nohost), capture_clause = (to)> |
| 121 |
} { |
| 122 |
omp.target {} |
| 123 |
func.return |
| 124 |
} |
| 125 |
func.func @host_target() -> () |
| 126 |
attributes { |
| 127 |
omp.declare_target = |
| 128 |
#omp.declaretarget<device_type = (host), capture_clause = (to)> |
| 129 |
} { |
| 130 |
omp.target {} |
| 131 |
func.return |
| 132 |
} |
| 133 |
func.func @none_target() -> () { |
| 134 |
omp.target {} |
| 135 |
func.return |
| 136 |
} |
| 137 |
} |