mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
36d0cb3fd9
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
12 lines
308 B
LLVM
12 lines
308 B
LLVM
; RUN: llc < %s -march=x86 | grep "movsbl"
|
|
|
|
@X = global i32 0 ; <i32*> [#uses=1]
|
|
|
|
define i32 @_Z3fooi(i32 %x) {
|
|
entry:
|
|
store i32 %x, i32* @X, align 4
|
|
%retval67 = trunc i32 %x to i8 ; <i8> [#uses=1]
|
|
%retval = sext i8 %retval67 to i32
|
|
ret i32 %retval
|
|
}
|