MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / test_recursive

Function test_recursive

runtime/test/test_argument_conversion.cpp:491–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491void test_recursive(mlir::MLIRContext *ctx) {
492 {
493 struct ure {
494 int _0;
495 double _1;
496 char _2;
497 short _3;
498 };
499 ure x0 = {static_cast<int>(0xcafebabe), 87.6545, 'A',
500 static_cast<short>(0xfade)};
501 ure x1 = {5412, 23894.5, 'B', 0xada};
502 ure x2 = {90210, 782934.78923, 'C', 747};
503 std::vector<ure> x = {x0, x1, x2};
504 std::vector<void *> v = {static_cast<void *>(&x)};
505 doSimpleTest(ctx, "!cc.stdvec<!cc.struct<{i32,f64,i8,i16}>>", v);
506 }
507 // clang-format off
508// CHECK: Source module:
509// CHECK: func.func private @callee(!cc.stdvec<!cc.struct<{i32, f64, i8, i16}>>)
510// CHECK: Substitution module:
511
512// CHECK-LABEL: cc.arg_subst[0] {
513// CHECK: %[[VAL_0:.*]] = cc.alloca !cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>
514// CHECK: %[[VAL_1:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
515// CHECK: %[[VAL_2:.*]] = arith.constant -889275714 : i32
516// CHECK: %[[VAL_3:.*]] = cc.insert_value %[[VAL_1]][0], %[[VAL_2]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
517// CHECK: %[[VAL_4:.*]] = arith.constant 87.654499999999998 : f64
518// CHECK: %[[VAL_5:.*]] = cc.insert_value %[[VAL_3]][1], %[[VAL_4]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
519// CHECK: %[[VAL_6:.*]] = arith.constant 65 : i8
520// CHECK: %[[VAL_7:.*]] = cc.insert_value %[[VAL_5]][2], %[[VAL_6]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
521// CHECK: %[[VAL_8:.*]] = arith.constant -1314 : i16
522// CHECK: %[[VAL_9:.*]] = cc.insert_value %[[VAL_7]][3], %[[VAL_8]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
523// 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}>>
524// CHECK: cc.store %[[VAL_9]], %[[VAL_10]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
525// CHECK: %[[VAL_11:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
526// CHECK: %[[VAL_12:.*]] = arith.constant 5412 : i32
527// CHECK: %[[VAL_13:.*]] = cc.insert_value %[[VAL_11]][0], %[[VAL_12]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
528// CHECK: %[[VAL_14:.*]] = arith.constant 2.389450e+04 : f64
529// CHECK: %[[VAL_15:.*]] = cc.insert_value %[[VAL_13]][1], %[[VAL_14]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
530// CHECK: %[[VAL_16:.*]] = arith.constant 66 : i8
531// CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_15]][2], %[[VAL_16]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
532// CHECK: %[[VAL_18:.*]] = arith.constant 2778 : i16
533// CHECK: %[[VAL_19:.*]] = cc.insert_value %[[VAL_17]][3], %[[VAL_18]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
534// 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}>>
535// CHECK: cc.store %[[VAL_19]], %[[VAL_20]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
536// CHECK: %[[VAL_21:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
537// CHECK: %[[VAL_22:.*]] = arith.constant 90210 : i32
538// CHECK: %[[VAL_23:.*]] = cc.insert_value %[[VAL_21]][0], %[[VAL_22]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
539// CHECK: %[[VAL_24:.*]] = arith.constant 782934.78922999999 : f64
540// CHECK: %[[VAL_25:.*]] = cc.insert_value %[[VAL_23]][1], %[[VAL_24]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
541// CHECK: %[[VAL_26:.*]] = arith.constant 67 : i8
542// CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_25]][2], %[[VAL_26]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
543// CHECK: %[[VAL_28:.*]] = arith.constant 747 : i16
544// CHECK: %[[VAL_29:.*]] = cc.insert_value %[[VAL_27]][3], %[[VAL_28]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
545// 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}>>
546// CHECK: cc.store %[[VAL_29]], %[[VAL_30]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
547// CHECK: %[[VAL_31:.*]] = arith.constant 3 : i64
548// CHECK: %[[VAL_32:.*]] = cc.stdvec_init %[[VAL_0]], %[[VAL_31]] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>, i64) -> !cc.stdvec<!cc.struct<{i32, f64, i8, i16}>>

Callers 1

mainFunction · 0.70

Calls 1

doSimpleTestFunction · 0.70

Tested by

no test coverage detected