| 1 | export fn not_comptime() callconv(.kernel) void { |
| 2 | var runtime: u32 = 42; |
| 3 | _ = &runtime; |
| 4 | _ = asm ("%ret = OpSpecConstant %ty $default" |
| 5 | : [ret] "" (-> u32), |
| 6 | : [ty] "t" (u32), |
| 7 | [default] "c" (runtime), |
| 8 | ); |
| 9 | } |
| 10 | |
| 11 | export fn undef_input() callconv(.kernel) void { |
| 12 | const x: u32 = undefined; |
| 13 | _ = asm ("%ret = OpDummy $x" |
| 14 | : [ret] "" (-> u32), |
| 15 | : [x] "c" (x), |
| 16 | ); |
| 17 | } |
| 18 | |
| 19 | export fn unsupported_type() callconv(.kernel) void { |
| 20 | const s = "hi"; |
| 21 | _ = asm ("%ret = OpDummy $x" |
| 22 | : [ret] "" (-> u32), |
| 23 | : [x] "c" (s), |
| 24 | ); |
| 25 | } |
| 26 | |
| 27 | // error |
| 28 | // backend=selfhosted |
| 29 | // target=spirv32-vulkan |
| 30 | // |
| 31 | // :7:26: error: assembly input with 'c' constraint must be compile-time known |
| 32 | // :15:20: error: assembly input with 'c' constraint cannot be undefined |
| 33 | // :23:20: error: unsupported type '*const [2:0]u8' for 'c' constraint |