diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2015-11-30 20:37:58 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2015-11-30 20:37:58 +0000 |
| commit | cdad10f333cf1bf81868b07f4f37d1d45418b103 (patch) | |
| tree | 9fd49363461d7061f4225583c4f14f06e8716994 /llvm/test/CodeGen/ARM | |
| parent | 8a71273d89f94dc3f609ba254e6690960411a5fd (diff) | |
| download | bcm5719-llvm-cdad10f333cf1bf81868b07f4f37d1d45418b103.tar.gz bcm5719-llvm-cdad10f333cf1bf81868b07f4f37d1d45418b103.zip | |
[ARM] For old thumb ISA like v4t, we cannot use PC directly in pop.
Fix the epilogue emission to account for that.
llvm-svn: 254325
Diffstat (limited to 'llvm/test/CodeGen/ARM')
| -rw-r--r-- | llvm/test/CodeGen/ARM/thumb1_return_sequence.ll | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll b/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll index 5b9c19ab5eb..67d1cad2cf6 100644 --- a/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll +++ b/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll @@ -23,9 +23,22 @@ entry: ; -------- ; CHECK-V4T: add sp, ; CHECK-V4T-NEXT: pop {[[SAVED]]} -; We do not have any SP update to insert so we can just optimize -; the pop sequence. -; CHECK-V4T-NEXT: pop {pc} +; The ISA for v4 does not support pop pc, so make sure we do not emit +; one even when we do not need to update SP. +; CHECK-V4T-NOT: pop {pc} +; We may only use lo register to pop, but in that case, all the scratch +; ones are used. +; r12 is the only register we are allowed to clobber for AAPCS. +; Use it to save a lo register. +; CHECK-V4T-NEXT: mov [[TEMP_REG:r12]], [[POP_REG:r[0-7]]] +; Pop the value of LR. +; CHECK-V4T-NEXT: pop {[[POP_REG]]} +; Copy the value of LR in the right register. +; CHECK-V4T-NEXT: mov lr, [[POP_REG]] +; Restore the value that was in the register we used to pop the value of LR. +; CHECK-V4T-NEXT: mov [[POP_REG]], [[TEMP_REG]] +; Return. +; CHECK-V4T-NEXT: bx lr ; CHECK-V5T: pop {[[SAVED]], pc} } @@ -93,7 +106,13 @@ entry: ; Epilogue ; -------- ; CHECK-V4T: pop {[[SAVED]]} -; CHECK-V4T: pop {pc} +; The ISA for v4 does not support pop pc, so make sure we do not emit +; one even when we do not need to update SP. +; CHECK-V4T-NOT: pop {pc} +; Pop the value of LR into a scratch lo register other than r0 (it is +; used for the return value). +; CHECK-V4T-NEXT: pop {[[POP_REG:r[1-3]]]} +; CHECK-V4T-NEXT: bx [[POP_REG]] ; CHECK-V5T: pop {[[SAVED]], pc} } |

