|
| 1 | +// RUN: cir-opt %s | FileCheck %s |
| 2 | + |
| 3 | +!s32i = !cir.int<s, 32> |
| 4 | +!u32i = !cir.int<u, 32> |
| 5 | + |
| 6 | +module { |
| 7 | +cir.func @f1() { |
| 8 | + // CHECK: cir.asm(x86_att, |
| 9 | + // CHECK: out = [], |
| 10 | + // CHECK: in = [], |
| 11 | + // CHECK: in_out = [], |
| 12 | + // CHECK: {"" "~{dirflag},~{fpsr},~{flags}"}) |
| 13 | + cir.asm(x86_att, |
| 14 | + out = [], |
| 15 | + in = [], |
| 16 | + in_out = [], |
| 17 | + {"" "~{dirflag},~{fpsr},~{flags}"}) |
| 18 | + cir.return |
| 19 | +} |
| 20 | + |
| 21 | +cir.func @f2() { |
| 22 | + // CHECK: cir.asm(x86_att, |
| 23 | + // CHECK: out = [], |
| 24 | + // CHECK: in = [], |
| 25 | + // CHECK: in_out = [], |
| 26 | + // CHECK: {"" "~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 27 | + cir.asm(x86_att, |
| 28 | + out = [], |
| 29 | + in = [], |
| 30 | + in_out = [], |
| 31 | + {"" "~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 32 | + cir.return |
| 33 | +} |
| 34 | + |
| 35 | +cir.func @f3() { |
| 36 | + // CHECK: cir.asm(x86_att, |
| 37 | + // CHECK: out = [], |
| 38 | + // CHECK: in = [], |
| 39 | + // CHECK: in_out = [], |
| 40 | + // CHECK: {"abc" "~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 41 | + cir.asm(x86_att, |
| 42 | + out = [], |
| 43 | + in = [], |
| 44 | + in_out = [], |
| 45 | + {"abc" "~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 46 | + cir.return |
| 47 | +} |
| 48 | + |
| 49 | +cir.func @f4(%arg0: !s32i) { |
| 50 | + %0 = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init] {alignment = 4 : i64} |
| 51 | + cir.store %arg0, %0 : !s32i, !cir.ptr<!s32i> |
| 52 | + // CHECK: cir.asm(x86_att, |
| 53 | + // CHECK: out = [], |
| 54 | + // CHECK: in = [%0 : !cir.ptr<!s32i> (maybe_memory)], |
| 55 | + // CHECK: in_out = [], |
| 56 | + // CHECK: {"" "*m,~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 57 | + cir.asm(x86_att, |
| 58 | + out = [], |
| 59 | + in = [%0 : !cir.ptr<!s32i> (maybe_memory)], |
| 60 | + in_out = [], |
| 61 | + {"" "*m,~{dirflag},~{fpsr},~{flags}"}) side_effects |
| 62 | + cir.return |
| 63 | +} |
| 64 | + |
| 65 | +cir.func @f5() { |
| 66 | + // CHECK: cir.asm(x86_intel, |
| 67 | + // CHECK: out = [], |
| 68 | + // CHECK: in = [], |
| 69 | + // CHECK: in_out = [], |
| 70 | + // CHECK: {"" "~{dirflag},~{fpsr},~{flags}"}) |
| 71 | + cir.asm(x86_intel, |
| 72 | + out = [], |
| 73 | + in = [], |
| 74 | + in_out = [], |
| 75 | + {"" "~{dirflag},~{fpsr},~{flags}"}) |
| 76 | + cir.return |
| 77 | +} |
| 78 | +cir.func @f6() -> !s32i { |
| 79 | + %0 = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init] {alignment = 4 : i64} |
| 80 | + // CHECK: %1 = cir.asm(x86_att, |
| 81 | + // CHECK: out = [], |
| 82 | + // CHECK: in = [], |
| 83 | + // CHECK: in_out = [], |
| 84 | + // CHECK: {"movl $$42, $0" "=r,~{dirflag},~{fpsr},~{flags}"}) side_effects -> !s32i |
| 85 | + %1 = cir.asm(x86_att, |
| 86 | + out = [], |
| 87 | + in = [], |
| 88 | + in_out = [], |
| 89 | + {"movl $$42, $0" "=r,~{dirflag},~{fpsr},~{flags}"}) side_effects -> !s32i |
| 90 | + cir.store align(4) %1, %0 : !s32i, !cir.ptr<!s32i> |
| 91 | + %3 = cir.load align(4) %0 : !cir.ptr<!s32i>, !s32i |
| 92 | + cir.return %3 : !s32i |
| 93 | +} |
| 94 | +cir.func @f7(%arg0: !u32i) -> !u32i { |
| 95 | + %0 = cir.alloca !u32i, !cir.ptr<!u32i>, ["x", init] {alignment = 4 : i64} |
| 96 | + cir.store %arg0, %0 : !u32i, !cir.ptr<!u32i> |
| 97 | + %1 = cir.load align(4) %0 : !cir.ptr<!u32i>, !u32i |
| 98 | + // CHECK: %2 = cir.asm(x86_att, |
| 99 | + // CHECK: out = [], |
| 100 | + // CHECK: in = [], |
| 101 | + // CHECK: in_out = [%1 : !u32i], |
| 102 | + // CHECK: {"addl $$42, $0" "=r,0,~{dirflag},~{fpsr},~{flags}"}) side_effects -> !u32i |
| 103 | + %2 = cir.asm(x86_att, |
| 104 | + out = [], |
| 105 | + in = [], |
| 106 | + in_out = [%1 : !u32i], |
| 107 | + {"addl $$42, $0" "=r,0,~{dirflag},~{fpsr},~{flags}"}) side_effects -> !u32i |
| 108 | + cir.store align(4) %2, %0 : !u32i, !cir.ptr<!u32i> |
| 109 | + %3 = cir.load align(4) %0 : !cir.ptr<!u32i>, !u32i |
| 110 | + cir.return %3 : !u32i |
| 111 | +} |
| 112 | +} |
0 commit comments