xref: /llvm-project/llvm/test/CodeGen/NVPTX/inlineasm-output-template.ll (revision b279f6b098d3849f7f1c1f539b108307d5f8ae2d)
1; RUN: llc -mtriple=nvptx64 < %s | FileCheck %s
2; RUN: %if ptxas %{ llc -mtriple=nvptx64 < %s | %ptxas-verify %}
3
4; Test that %c works with immediates
5; CHECK-LABEL: test_inlineasm_c_output_template0
6; CHECK: //TEST 42
7define dso_local i32 @test_inlineasm_c_output_template0() {
8  tail call void asm sideeffect "//TEST ${0:c}", "i"(i32 42)
9  ret i32 42
10}
11
12; Test that %c works with global address
13; FIXME: seems this case isn't handled properly by
14; SelectionDAG TargetLowering::LowerAsmOperandForConstraint?
15; check: test_inlineasm_c_output_template1
16; check: //TEST baz
17;@baz = internal global i32 0, align 4
18;define dso_local i32 @test_inlineasm_c_output_template1() {
19;  tail call void asm sideeffect "//TEST ${0:c}", "i"(ptr nonnull @baz)
20;  ret i32 42
21;}
22
23; Test that %n works with immediates
24; CHECK-LABEL: test_inlineasm_c_output_template2
25; CHECK: //TEST -42
26define dso_local i32 @test_inlineasm_c_output_template2() {
27  tail call void asm sideeffect "//TEST ${0:n}", "i"(i32 42)
28  ret i32 42
29}
30