summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/tail-call-attrs.ll
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-02-08 19:34:30 +0000
committerHans Wennborg <hans@hanshq.net>2016-02-08 19:34:30 +0000
commit850ec6ca18e70fda3cfd4f41c5193bad5057fc2b (patch)
tree56c94bd4ccf799cbfe9743452b67d93025e59cc7 /llvm/test/CodeGen/X86/tail-call-attrs.ll
parentbc130af4341898c394890a03764c0f51ab98c7a6 (diff)
downloadbcm5719-llvm-850ec6ca18e70fda3cfd4f41c5193bad5057fc2b.tar.gz
bcm5719-llvm-850ec6ca18e70fda3cfd4f41c5193bad5057fc2b.zip
[X86] Don't zero/sign-extend i1, i8, or i16 return values to 32 bits (PR22532)
This matches GCC and MSVC's behaviour, and saves on code size. We were already not extending i1 return values on x86_64 after r127766. This takes that patch further by applying it to x86 target as well, and also for i8 and i16. The ABI docs have been unclear about the required behaviour here. The new i386 psABI [1] clearly states (Table 2.4, page 14) that i1, i8, and i16 return vales do not need to be extended beyond 8 bits. The x86_64 ABI doc is being updated to say the same [2]. Differential Revision: http://reviews.llvm.org/D16907 [1]. https://01.org/sites/default/files/file_attach/intel386-psabi-1.0.pdf [2]. https://groups.google.com/d/msg/x86-64-abi/E8O33onbnGQ/_RFWw_ixDQAJ llvm-svn: 260133
Diffstat (limited to 'llvm/test/CodeGen/X86/tail-call-attrs.ll')
-rw-r--r--llvm/test/CodeGen/X86/tail-call-attrs.ll4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/tail-call-attrs.ll b/llvm/test/CodeGen/X86/tail-call-attrs.ll
index 17ebe997c8c..90f1346de9a 100644
--- a/llvm/test/CodeGen/X86/tail-call-attrs.ll
+++ b/llvm/test/CodeGen/X86/tail-call-attrs.ll
@@ -13,11 +13,11 @@ define zeroext i1 @test_bool() {
; Here, there's more zero extension to be done between the call and the return,
; so a tail call is impossible (well, according to current Clang practice
; anyway. The AMD64 ABI isn't crystal clear on the matter).
+; FIXME: The high 24 bits returned from test_i32 are undefined; do tail call!
declare zeroext i32 @give_i32()
define zeroext i8 @test_i32() {
; CHECK-LABEL: test_i32:
; CHECK: callq _give_i32
-; CHECK: movzbl %al, %eax
; CHECK: ret
%call = tail call zeroext i32 @give_i32()
@@ -27,11 +27,11 @@ define zeroext i8 @test_i32() {
; Here, one function is zeroext and the other is signext. To the extent that
; these both mean something they are incompatible so no tail call is possible.
+; FIXME: The high 16 bits returned are undefined; do tail call!
declare zeroext i16 @give_unsigned_i16()
define signext i16 @test_incompatible_i16() {
; CHECK-LABEL: test_incompatible_i16:
; CHECK: callq _give_unsigned_i16
-; CHECK: cwtl
; CHECK: ret
%call = tail call zeroext i16 @give_unsigned_i16()
OpenPOWER on IntegriCloud