|
| 1 | +// RUN: tco --fir-to-llvm-ir %s | FileCheck %s |
| 2 | + |
| 3 | +fir.global internal @_QEmask : !fir.array<32xi32> { |
| 4 | + %c0_i32 = constant 1 : i32 |
| 5 | + %0 = fir.undefined !fir.array<32xi32> |
| 6 | + %2 = fir.insert_on_range %0, %c0_i32, [0 : index, 31 : index] : (!fir.array<32xi32>, i32) -> !fir.array<32xi32> |
| 7 | + fir.has_value %2 : !fir.array<32xi32> |
| 8 | +} |
| 9 | + |
| 10 | +// CHECK: llvm.mlir.global internal @_QEmask() : !llvm.array<32 x i32> { |
| 11 | +// CHECK: [[VAL0:%.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 12 | +// CHECK: [[VAL1:%.*]] = llvm.mlir.undef : !llvm.array<32 x i32> |
| 13 | +// CHECK: [[VAL2:%.*]] = llvm.mlir.constant(dense<1> : vector<32xi32>) : !llvm.array<32 x i32> |
| 14 | +// CHECK: llvm.return [[VAL2]] : !llvm.array<32 x i32> |
| 15 | +// CHECK: } |
| 16 | + |
| 17 | +fir.global internal @_QEmultiarray : !fir.array<32x32xi32> { |
| 18 | + %c0_i32 = constant 1 : i32 |
| 19 | + %0 = fir.undefined !fir.array<32x32xi32> |
| 20 | + %2 = fir.insert_on_range %0, %c0_i32, [0 : index, 31 : index, 0 : index, 31 : index] : (!fir.array<32x32xi32>, i32) -> !fir.array<32x32xi32> |
| 21 | + fir.has_value %2 : !fir.array<32x32xi32> |
| 22 | +} |
| 23 | + |
| 24 | +// CHECK: llvm.mlir.global internal @_QEmultiarray() : !llvm.array<32 x array<32 x i32>> { |
| 25 | +// CHECK: [[VAL0:%.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 26 | +// CHECK: [[VAL1:%.*]] = llvm.mlir.undef : !llvm.array<32 x array<32 x i32>> |
| 27 | +// CHECK: [[VAL2:%.*]] = llvm.mlir.constant(dense<1> : vector<32x32xi32>) : !llvm.array<32 x array<32 x i32>> |
| 28 | +// CHECK: llvm.return [[VAL2]] : !llvm.array<32 x array<32 x i32>> |
| 29 | +// CHECK: } |
| 30 | + |
| 31 | +fir.global internal @_QEmasklogical : !fir.array<32768x!fir.logical<4>> { |
| 32 | + %true = constant true |
| 33 | + %0 = fir.undefined !fir.array<32768x!fir.logical<4>> |
| 34 | + %1 = fir.convert %true : (i1) -> !fir.logical<4> |
| 35 | + %2 = fir.insert_on_range %0, %1, [0 : index, 32767 : index] : (!fir.array<32768x!fir.logical<4>>, !fir.logical<4>) -> !fir.array<32768x!fir.logical<4>> |
| 36 | + fir.has_value %2 : !fir.array<32768x!fir.logical<4>> |
| 37 | +} |
| 38 | + |
| 39 | +// CHECK: llvm.mlir.global internal @_QEmasklogical() : !llvm.array<32768 x i32> { |
| 40 | +// CHECK: [[VAL0:%.*]] = llvm.mlir.constant(true) : i1 |
| 41 | +// CHECK: [[VAL1:%.*]] = llvm.mlir.undef : !llvm.array<32768 x i32> |
| 42 | +// CHECK: [[VAL2:%.*]] = llvm.sext [[VAL0]] : i1 to i32 |
| 43 | +// CHECK: [[VAL3:%.*]] = llvm.mlir.constant(dense<true> : vector<32768xi1>) : !llvm.array<32768 x i32> |
| 44 | +// CHECK: llvm.return [[VAL3]] : !llvm.array<32768 x i32> |
| 45 | +// CHECK: } |
| 46 | + |
| 47 | +fir.global internal @_QElookforme : !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}> { |
| 48 | + %c2_i32 = constant 2 : i32 |
| 49 | + %c52_i32 = constant 52 : i32 |
| 50 | + %0 = fir.undefined !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}> |
| 51 | + %1 = fir.undefined !fir.array<500xi32> |
| 52 | + %2 = fir.insert_on_range %1, %c2_i32, [0 : index, 499 : index] : (!fir.array<500xi32>, i32) -> !fir.array<500xi32> |
| 53 | + %3 = fir.insert_value %0, %2, ["i", !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}>] :(!fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}>, !fir.array<500xi32>) -> !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}> |
| 54 | + %4 = fir.insert_on_range %1, %c52_i32, [0 : index, 499 : index] : (!fir.array<500xi32>, i32) -> !fir.array<500xi32> |
| 55 | + %5 = fir.insert_value %3, %4, ["j", !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}>] : (!fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}>, !fir.array<500xi32>) -> !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}> |
| 56 | + fir.has_value %5 : !fir.type<_QTt{i:!fir.array<500xi32>,j:!fir.array<500xi32>}> |
| 57 | +} |
| 58 | + |
| 59 | +// CHECK: llvm.mlir.global internal @_QElookforme() : !llvm.struct<"_QTt", (array<500 x i32>, array<500 x i32>)> { |
| 60 | +// CHECK: [[CST0:%.*]] = llvm.mlir.constant(2 : i32) : i32 |
| 61 | +// CHECK: [[CST1:%.*]] = llvm.mlir.constant(52 : i32) : i32 |
| 62 | +// CHECK: [[STRUCT:%.*]] = llvm.mlir.undef : !llvm.struct<"_QTt", (array<500 x i32>, array<500 x i32>)> |
| 63 | +// CHECK: [[ARR1:%.*]] = llvm.mlir.undef : !llvm.array<500 x i32> |
| 64 | +// CHECK: [[DENSE1:%.*]] = llvm.mlir.constant(dense<2> : vector<500xi32>) : !llvm.array<500 x i32> |
| 65 | +// CHECK: [[STRUCT1:%.*]] = llvm.insertvalue [[DENSE1]], [[STRUCT]][0 : i32] : !llvm.struct<"_QTt", (array<500 x i32>, array<500 x i32>)> |
| 66 | +// CHECK: [[DENSE2:%.*]] = llvm.mlir.constant(dense<52> : vector<500xi32>) : !llvm.array<500 x i32> |
| 67 | +// CHECK: [[STRUCT2:%.*]] = llvm.insertvalue [[DENSE2]], [[STRUCT1]][1 : i32] : !llvm.struct<"_QTt", (array<500 x i32>, array<500 x i32>)> |
| 68 | +// CHECK: llvm.return [[STRUCT2]] : !llvm.struct<"_QTt", (array<500 x i32>, array<500 x i32>)> |
| 69 | +// CHECK: } |
0 commit comments