Skip to content

Commit

Permalink
[core] Some enhancements to the cc.insert_value op. (#2589)
Browse files Browse the repository at this point in the history
Fixes a typo in the syntax so that the argument order matches the type
of the arguments.

Adds a verifier. Fix up the tests to reflect the changes.

Signed-off-by: Eric Schweitz <[email protected]>
  • Loading branch information
schweitzpgi authored Feb 6, 2025
1 parent 5e9dc6a commit 8b37cb3
Show file tree
Hide file tree
Showing 18 changed files with 202 additions and 97 deletions.
7 changes: 5 additions & 2 deletions include/cudaq/Optimizer/Dialect/CC/CCOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def AnyCallableType : Type<CPred<"$_self.isa<cudaq::cc::CallableType, "
"mlir::FunctionType>()">, "any callable type">;

def AnyAggregateType : Type<CPred<"$_self.isa<cudaq::cc::StructType, "
"cudaq::cc::ArrayType>()">, "any aggregate type">;
"cudaq::cc::ArrayType, mlir::ComplexType>()">,
"any aggregate type">;

//===----------------------------------------------------------------------===//
// Base operation definition.
Expand Down Expand Up @@ -1022,10 +1023,12 @@ def cc_InsertValueOp : CCOp<"insert_value", [Pure]> {
let results = (outs AnyAggregateType);

let assemblyFormat = [{
$value `,` $container `` $position `:` functional-type(operands, results)
$container `` $position `,` $value `:` functional-type(operands, results)
attr-dict
}];

let hasVerifier = 1;

let builders = [
OpBuilder<(ins "mlir::Type":$resultType, "mlir::Value":$aggregate,
"mlir::Value":$newValue, "std::int64_t":$index), [{
Expand Down
8 changes: 4 additions & 4 deletions lib/Optimizer/Builder/Intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ static constexpr IntrinsicCode intrinsicTable[] = {
%6 = cc.compute_ptr %10[%arg1] : (!cc.ptr<!cc.array<i8 x ?>>, i64) -> !cc.ptr<i8>
call @llvm.memcpy.p0i8.p0i8.i64(%6, %5, %1, %false) : (!cc.ptr<i8>, !cc.ptr<i8>, i64, i1) -> ()
%7 = cc.undef !cc.struct<{!cc.ptr<i8>, i64}>
%8 = cc.insert_value %3, %7[0] : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
%9 = cc.insert_value %2, %8[1] : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
%8 = cc.insert_value %7[0], %3 : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
%9 = cc.insert_value %8[1], %2 : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
%11 = cc.compute_ptr %10[%arg3] : (!cc.ptr<!cc.array<i8 x ?>>, i64) -> !cc.ptr<i8>
%12 = cc.cast %11 : (!cc.ptr<i8>) -> !cc.ptr<!cc.ptr<i8>>
cc.store %6, %12 : !cc.ptr<!cc.ptr<i8>>
Expand Down Expand Up @@ -345,8 +345,8 @@ static constexpr IntrinsicCode intrinsicTable[] = {
%c0_i64 = arith.constant 0 : i64
%0 = cc.cast %c0_i64 : (i64) -> !cc.ptr<i8>
%1 = cc.undef !cc.struct<{!cc.ptr<i8>, i64}>
%2 = cc.insert_value %0, %1[0] : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
%3 = cc.insert_value %c0_i64, %2[1] : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
%2 = cc.insert_value %1[0], %0 : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
%3 = cc.insert_value %2[1], %c0_i64 : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
return %3 : !cc.struct<{!cc.ptr<i8>, i64}>
})#"},

Expand Down
39 changes: 39 additions & 0 deletions lib/Optimizer/Dialect/CC/CCOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,45 @@ void cudaq::cc::GlobalOp::print(OpAsmPrinter &p) {
getExternalAttrName(), getSymVisibilityAttrName()});
}

//===----------------------------------------------------------------------===//
// InsertValueOp
//===----------------------------------------------------------------------===//

LogicalResult cudaq::cc::InsertValueOp::verify() {
Type eleTy = getContainer().getType();
auto resultTy = getResult().getType();

if (!isCompatible(eleTy, resultTy))
return emitOpError("result type does not match input");

for (std::int32_t i : getPosition()) {
if (auto arrTy = dyn_cast<cc::ArrayType>(eleTy)) {
if (arrTy.isUnknownSize())
return emitOpError("array must have constant size");
if (i < 0 || static_cast<std::int64_t>(i) >= arrTy.getSize())
return emitOpError("array cannot index out of bounds elements");
eleTy = arrTy.getElementType();
} else if (auto strTy = dyn_cast<cc::StructType>(eleTy)) {
if (i < 0 || static_cast<std::size_t>(i) >= strTy.getMembers().size())
return emitOpError("struct cannot index out of bounds members");
eleTy = strTy.getMember(i);
} else if (auto complexTy = dyn_cast<ComplexType>(eleTy)) {
if (!(i == 0 || i == 1))
return emitOpError("complex index is out of bounds");
eleTy = complexTy.getElementType();
} else {
return emitOpError(std::string{"too many indices ("} +
std::to_string(getPosition().size()) +
") for the source pointer");
}
}

Type valTy = getValue().getType();
if (!isCompatible(valTy, eleTy))
return emitOpError("value type does not match selected element");
return success();
}

//===----------------------------------------------------------------------===//
// StdvecDataOp
//===----------------------------------------------------------------------===//
Expand Down
4 changes: 2 additions & 2 deletions python/tests/mlir/ast_elif.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def cost(thetas: np.ndarray): # can pass 1D ndarray or list
# CHECK: %[[VAL_14:.*]] = cc.compute_ptr %[[VAL_13]][%[[VAL_11]]] : (!cc.ptr<!cc.array<f64 x ?>>, i64) -> !cc.ptr<f64>
# CHECK: %[[VAL_15:.*]] = cc.load %[[VAL_14]] : !cc.ptr<f64>
# CHECK: %[[VAL_16:.*]] = cc.compute_ptr %[[VAL_7]]{{\[}}%[[VAL_11]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, f64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, f64}>>
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_11]], %[[VAL_12]][0] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_15]], %[[VAL_17]][1] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_12]][0], %[[VAL_11]] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_17]][1], %[[VAL_15]] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
# CHECK: cc.store %[[VAL_18]], %[[VAL_16]] : !cc.ptr<!cc.struct<{i64, f64}>>
# CHECK: cc.continue %[[VAL_11]] : i64
# CHECK: } step {
Expand Down
4 changes: 2 additions & 2 deletions python/tests/mlir/ast_list_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def kernel():
# CHECK: %[[VAL_24:.*]] = cc.compute_ptr %[[VAL_23]][%[[VAL_21]]] : (!cc.ptr<!cc.array<f64 x ?>>, i64) -> !cc.ptr<f64>
# CHECK: %[[VAL_25:.*]] = cc.load %[[VAL_24]] : !cc.ptr<f64>
# CHECK: %[[VAL_26:.*]] = cc.compute_ptr %[[VAL_17]][%[[VAL_21]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, f64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, f64}>>
# CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_21]], %[[VAL_22]][0] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_28:.*]] = cc.insert_value %[[VAL_25]], %[[VAL_27]][1] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_22]][0], %[[VAL_21]] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
# CHECK: %[[VAL_28:.*]] = cc.insert_value %[[VAL_27]][1], %[[VAL_25]] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
# CHECK: cc.store %[[VAL_28]], %[[VAL_26]] : !cc.ptr<!cc.struct<{i64, f64}>>
# CHECK: cc.continue %[[VAL_21]] : i64
# CHECK: } step {
Expand Down
4 changes: 2 additions & 2 deletions python/tests/mlir/ast_list_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def oracle(register: cudaq.qview, auxillary_qubit: cudaq.qubit,
# CHECK: %[[VAL_14:.*]] = cc.compute_ptr %[[VAL_13]][%[[VAL_11]]] : (!cc.ptr<!cc.array<i64 x ?>>, i64) -> !cc.ptr<i64>
# CHECK: %[[VAL_15:.*]] = cc.load %[[VAL_14]] : !cc.ptr<i64>
# CHECK: %[[VAL_16:.*]] = cc.compute_ptr %[[VAL_7]]{{\[}}%[[VAL_11]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, i64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, i64}>>
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_11]], %[[VAL_12]][0] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_15]], %[[VAL_17]][1] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_12]][0], %[[VAL_11]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_17]][1], %[[VAL_15]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: cc.store %[[VAL_18]], %[[VAL_16]] : !cc.ptr<!cc.struct<{i64, i64}>>
# CHECK: cc.continue %[[VAL_11]] : i64
# CHECK: } step {
Expand Down
4 changes: 2 additions & 2 deletions python/tests/mlir/ast_qreg_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def slice():
# CHECK: %[[VAL_39:.*]] = cc.compute_ptr %[[VAL_38]][%[[VAL_36]]] : (!cc.ptr<!cc.array<i64 x ?>>, i64) -> !cc.ptr<i64>
# CHECK: %[[VAL_40:.*]] = cc.load %[[VAL_39]] : !cc.ptr<i64>
# CHECK: %[[VAL_41:.*]] = cc.compute_ptr %[[VAL_32]]{{\[}}%[[VAL_36]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, i64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, i64}>>
# CHECK: %[[VAL_42:.*]] = cc.insert_value %[[VAL_36]], %[[VAL_37]][0] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_43:.*]] = cc.insert_value %[[VAL_40]], %[[VAL_42]][1] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_42:.*]] = cc.insert_value %[[VAL_37]][0], %[[VAL_36]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: %[[VAL_43:.*]] = cc.insert_value %[[VAL_42]][1], %[[VAL_40]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
# CHECK: cc.store %[[VAL_43]], %[[VAL_41]] : !cc.ptr<!cc.struct<{i64, i64}>>
# CHECK: cc.continue %[[VAL_36]] : i64
# CHECK: } step {
Expand Down
4 changes: 2 additions & 2 deletions python/tests/mlir/ghz.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def simple(numQubits: int):
# CHECK: %[[VAL_17:.*]] = cc.undef !cc.struct<{i64, !quake.ref}>
# CHECK: %[[VAL_18:.*]] = quake.extract_ref %[[VAL_10]]{{\[}}%[[VAL_16]]] : (!quake.veq<?>, i64) -> !quake.ref
# CHECK: %[[VAL_19:.*]] = cc.compute_ptr %[[VAL_12]]{{\[}}%[[VAL_16]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, !quake.ref}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, !quake.ref}>>
# CHECK: %[[VAL_20:.*]] = cc.insert_value %[[VAL_16]], %[[VAL_17]][0] : (!cc.struct<{i64, !quake.ref}>, i64) -> !cc.struct<{i64, !quake.ref}>
# CHECK: %[[VAL_21:.*]] = cc.insert_value %[[VAL_18]], %[[VAL_20]][1] : (!cc.struct<{i64, !quake.ref}>, !quake.ref) -> !cc.struct<{i64, !quake.ref}>
# CHECK: %[[VAL_20:.*]] = cc.insert_value %[[VAL_17]][0], %[[VAL_16]] : (!cc.struct<{i64, !quake.ref}>, i64) -> !cc.struct<{i64, !quake.ref}>
# CHECK: %[[VAL_21:.*]] = cc.insert_value %[[VAL_20]][1], %[[VAL_18]] : (!cc.struct<{i64, !quake.ref}>, !quake.ref) -> !cc.struct<{i64, !quake.ref}>
# CHECK: cc.store %[[VAL_21]], %[[VAL_19]] : !cc.ptr<!cc.struct<{i64, !quake.ref}>>
# CHECK: cc.continue %[[VAL_16]] : i64
# CHECK: } step {
Expand Down
32 changes: 16 additions & 16 deletions runtime/test/test_argument_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ void test_aggregates(mlir::MLIRContext *ctx) {
// CHECK-LABEL: cc.arg_subst[0] {
// CHECK: %[[VAL_0:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_1:.*]] = arith.constant -889275714 : i32
// CHECK: %[[VAL_2:.*]] = cc.insert_value %[[VAL_1]], %[[VAL_0]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_2:.*]] = cc.insert_value %[[VAL_0]][0], %[[VAL_1]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_3:.*]] = arith.constant 87.654499999999998 : f64
// CHECK: %[[VAL_4:.*]] = cc.insert_value %[[VAL_3]], %[[VAL_2]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_4:.*]] = cc.insert_value %[[VAL_2]][1], %[[VAL_3]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_5:.*]] = arith.constant 65 : i8
// CHECK: %[[VAL_6:.*]] = cc.insert_value %[[VAL_5]], %[[VAL_4]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_6:.*]] = cc.insert_value %[[VAL_4]][2], %[[VAL_5]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_7:.*]] = arith.constant -1314 : i16
// CHECK: %[[VAL_8:.*]] = cc.insert_value %[[VAL_7]], %[[VAL_6]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_8:.*]] = cc.insert_value %[[VAL_6]][3], %[[VAL_7]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: }
// clang-format on
}
Expand Down Expand Up @@ -324,35 +324,35 @@ void test_recursive(mlir::MLIRContext *ctx) {
// CHECK: %[[VAL_0:.*]] = cc.alloca !cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>
// CHECK: %[[VAL_1:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_2:.*]] = arith.constant -889275714 : i32
// CHECK: %[[VAL_3:.*]] = cc.insert_value %[[VAL_2]], %[[VAL_1]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_3:.*]] = cc.insert_value %[[VAL_1]][0], %[[VAL_2]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_4:.*]] = arith.constant 87.654499999999998 : f64
// CHECK: %[[VAL_5:.*]] = cc.insert_value %[[VAL_4]], %[[VAL_3]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_5:.*]] = cc.insert_value %[[VAL_3]][1], %[[VAL_4]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_6:.*]] = arith.constant 65 : i8
// CHECK: %[[VAL_7:.*]] = cc.insert_value %[[VAL_6]], %[[VAL_5]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_7:.*]] = cc.insert_value %[[VAL_5]][2], %[[VAL_6]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_8:.*]] = arith.constant -1314 : i16
// CHECK: %[[VAL_9:.*]] = cc.insert_value %[[VAL_8]], %[[VAL_7]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_9:.*]] = cc.insert_value %[[VAL_7]][3], %[[VAL_8]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_10:.*]] = cc.compute_ptr %[[VAL_0]][0] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: cc.store %[[VAL_9]], %[[VAL_10]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: %[[VAL_11:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_12:.*]] = arith.constant 5412 : i32
// CHECK: %[[VAL_13:.*]] = cc.insert_value %[[VAL_12]], %[[VAL_11]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_13:.*]] = cc.insert_value %[[VAL_11]][0], %[[VAL_12]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_14:.*]] = arith.constant 2.389450e+04 : f64
// CHECK: %[[VAL_15:.*]] = cc.insert_value %[[VAL_14]], %[[VAL_13]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_15:.*]] = cc.insert_value %[[VAL_13]][1], %[[VAL_14]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_16:.*]] = arith.constant 66 : i8
// CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_16]], %[[VAL_15]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_15]][2], %[[VAL_16]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_18:.*]] = arith.constant 2778 : i16
// CHECK: %[[VAL_19:.*]] = cc.insert_value %[[VAL_18]], %[[VAL_17]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_19:.*]] = cc.insert_value %[[VAL_17]][3], %[[VAL_18]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_20:.*]] = cc.compute_ptr %[[VAL_0]][1] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: cc.store %[[VAL_19]], %[[VAL_20]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: %[[VAL_21:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_22:.*]] = arith.constant 90210 : i32
// CHECK: %[[VAL_23:.*]] = cc.insert_value %[[VAL_22]], %[[VAL_21]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_23:.*]] = cc.insert_value %[[VAL_21]][0], %[[VAL_22]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_24:.*]] = arith.constant 782934.78922999999 : f64
// CHECK: %[[VAL_25:.*]] = cc.insert_value %[[VAL_24]], %[[VAL_23]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_25:.*]] = cc.insert_value %[[VAL_23]][1], %[[VAL_24]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_26:.*]] = arith.constant 67 : i8
// CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_26]], %[[VAL_25]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_25]][2], %[[VAL_26]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_28:.*]] = arith.constant 747 : i16
// CHECK: %[[VAL_29:.*]] = cc.insert_value %[[VAL_28]], %[[VAL_27]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_29:.*]] = cc.insert_value %[[VAL_27]][3], %[[VAL_28]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
// CHECK: %[[VAL_30:.*]] = cc.compute_ptr %[[VAL_0]][2] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: cc.store %[[VAL_29]], %[[VAL_30]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
// CHECK: %[[VAL_31:.*]] = arith.constant 3 : i64
Expand Down
8 changes: 4 additions & 4 deletions test/Quake/arg_subst-3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
cc.arg_subst[0] {
%0 = cc.undef !cc.struct<{i32, f64, i8, i16}>
%c-889275714_i32 = arith.constant -889275714 : i32
%1 = cc.insert_value %c-889275714_i32, %0[0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
%1 = cc.insert_value %0[0], %c-889275714_i32 : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
%cst = arith.constant 87.654499999999998 : f64
%2 = cc.insert_value %cst, %1[1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
%2 = cc.insert_value %1[1], %cst : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
%c65_i8 = arith.constant 65 : i8
%3 = cc.insert_value %c65_i8, %2[2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
%3 = cc.insert_value %2[2], %c65_i8 : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
%c-1314_i16 = arith.constant -1314 : i16
%4 = cc.insert_value %c-1314_i16, %3[3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
%4 = cc.insert_value %3[3], %c-1314_i16 : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
}
Loading

0 comments on commit 8b37cb3

Please sign in to comment.