diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-08-19 19:05:34 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-08-19 19:05:34 +0000 |
| commit | 5ef93b0c4ceb0c6ace49227fb0631d9cafbfbc15 (patch) | |
| tree | 2b5c862c434a5fd2ab52c032aa9fd7d8f9e776f0 /llvm/test | |
| parent | 5f1cea414123eff634d3d7e0320cdb3f0a825e57 (diff) | |
| download | bcm5719-llvm-5ef93b0c4ceb0c6ace49227fb0631d9cafbfbc15.tar.gz bcm5719-llvm-5ef93b0c4ceb0c6ace49227fb0631d9cafbfbc15.zip | |
MIR Serialization: Serialize instruction's register ties.
This commit serializes the machine instruction's register operand ties.
The ties are printed out only when the instructon has register ties that are
different from the ties that are specified in the instruction's description.
llvm-svn: 245482
Diffstat (limited to 'llvm/test')
6 files changed, 150 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/X86/def-register-already-tied-error.mir b/llvm/test/CodeGen/MIR/X86/def-register-already-tied-error.mir new file mode 100644 index 00000000000..69c816f59b9 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/def-register-already-tied-error.mir @@ -0,0 +1,25 @@ +# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +--- | + define i64 @test(i64 %x) #0 { + entry: + %asm = tail call i64 asm sideeffect "$foo", "=r,0"(i64 %x) nounwind + ret i64 %asm + } + + attributes #0 = { nounwind } +... +--- +name: test +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } +body: | + bb.0.entry: + liveins: %rdi + + ; CHECK: [[@LINE+1]]:83: the tied-def operand #3 is already tied with another register operand + INLINEASM $"$foo", 1, 2818058, def %rdi, 2147483657, killed %rdi(tied-def 3), killed %rdi(tied-def 3) + %rax = COPY killed %rdi + RETQ killed %rax +... diff --git a/llvm/test/CodeGen/MIR/X86/expected-integer-after-tied-def.mir b/llvm/test/CodeGen/MIR/X86/expected-integer-after-tied-def.mir new file mode 100644 index 00000000000..580d2bc0a41 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/expected-integer-after-tied-def.mir @@ -0,0 +1,25 @@ +# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +--- | + define i64 @test(i64 %x) #0 { + entry: + %asm = tail call i64 asm sideeffect "$foo", "=r,0"(i64 %x) nounwind + ret i64 %asm + } + + attributes #0 = { nounwind } +... +--- +name: test +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } +body: | + bb.0.entry: + liveins: %rdi + + ; CHECK: [[@LINE+1]]:78: expected an integer literal after 'tied-def' + INLINEASM $"$foo", 1, 2818058, def %rdi, 2147483657, killed %rdi(tied-def) + %rax = COPY killed %rdi + RETQ killed %rax +... diff --git a/llvm/test/CodeGen/MIR/X86/expected-tied-def-after-lparen.mir b/llvm/test/CodeGen/MIR/X86/expected-tied-def-after-lparen.mir new file mode 100644 index 00000000000..e8d6afd5333 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/expected-tied-def-after-lparen.mir @@ -0,0 +1,25 @@ +# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +--- | + define i64 @test(i64 %x) #0 { + entry: + %asm = tail call i64 asm sideeffect "$foo", "=r,0"(i64 %x) nounwind + ret i64 %asm + } + + attributes #0 = { nounwind } +... +--- +name: test +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } +body: | + bb.0.entry: + liveins: %rdi + + ; CHECK: [[@LINE+1]]:70: expected 'tied-def' after '(' + INLINEASM $"$foo", 1, 2818058, def %rdi, 2147483657, killed %rdi(3) + %rax = COPY killed %rdi + RETQ killed %rax +... diff --git a/llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir b/llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir index cad1d22030b..3fd56589109 100644 --- a/llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir +++ b/llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir @@ -8,6 +8,13 @@ ret i64 %x1 } + define i64 @test2(i64 %x, i64 %y) #0 { + entry: + %x0 = call { i64, i64 } asm "foo", "=r,=r,1,0,~{dirflag},~{fpsr},~{flags}"(i64 %x, i64 %y) #0 + %x1 = extractvalue { i64, i64 } %x0, 0 + ret i64 %x1 + } + attributes #0 = { nounwind } ... --- @@ -27,3 +34,21 @@ body: | %rax = MOV64rr killed %rsi RETQ killed %rax ... +--- +name: test2 +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } + - { reg: '%rsi' } +body: | + bb.0.entry: + liveins: %rdi, %rsi + + ; Verify that the register ties are preserved. + ; CHECK-LABEL: name: test2 + ; CHECK: INLINEASM $foo, 0, 2818058, def %rsi, 2818058, def dead %rdi, 2147549193, killed %rdi(tied-def 5), 2147483657, killed %rsi(tied-def 3), 12, implicit-def dead early-clobber %eflags + INLINEASM $foo, 0, 2818058, def %rsi, 2818058, def dead %rdi, 2147549193, killed %rdi(tied-def 5), 2147483657, killed %rsi(tied-def 3), 12, implicit-def dead early-clobber %eflags + %rax = MOV64rr killed %rsi + RETQ killed %rax +... diff --git a/llvm/test/CodeGen/MIR/X86/invalid-tied-def-index-error.mir b/llvm/test/CodeGen/MIR/X86/invalid-tied-def-index-error.mir new file mode 100644 index 00000000000..00436adca48 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/invalid-tied-def-index-error.mir @@ -0,0 +1,25 @@ +# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +--- | + define i64 @test(i64 %x) #0 { + entry: + %asm = tail call i64 asm sideeffect "$foo", "=r,0"(i64 %x) nounwind + ret i64 %asm + } + + attributes #0 = { nounwind } +... +--- +name: test +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } +body: | + bb.0.entry: + liveins: %rdi + + ; CHECK: [[@LINE+1]]:58: use of invalid tied-def operand index '300'; instruction has only 6 operands + INLINEASM $"$foo", 1, 2818058, def %rdi, 2147483657, killed %rdi(tied-def 300) + %rax = COPY killed %rdi + RETQ killed %rax +... diff --git a/llvm/test/CodeGen/MIR/X86/tied-def-operand-invalid.mir b/llvm/test/CodeGen/MIR/X86/tied-def-operand-invalid.mir new file mode 100644 index 00000000000..fe5263df355 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/tied-def-operand-invalid.mir @@ -0,0 +1,25 @@ +# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +--- | + define i64 @test(i64 %x) #0 { + entry: + %asm = tail call i64 asm sideeffect "$foo", "=r,0"(i64 %x) nounwind + ret i64 %asm + } + + attributes #0 = { nounwind } +... +--- +name: test +hasInlineAsm: true +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } +body: | + bb.0.entry: + liveins: %rdi + + ; CHECK: [[@LINE+1]]:58: use of invalid tied-def operand index '0'; the operand #0 isn't a defined register + INLINEASM $"$foo", 1, 2818058, def %rdi, 2147483657, killed %rdi(tied-def 0) + %rax = COPY killed %rdi + RETQ killed %rax +... |

