Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIPS] fix extension of integer types (function calls)
On MIPS unsigned int type should not be zero extended but sign-extended. Patch by Strahinja Petrovic. Differential Revision: http://reviews.llvm.org/D9198 llvm-svn: 238200
- Loading branch information
1 parent
0af4f63
commit 9aa0f16
Showing
7 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang -target mips64-unknown-linux -O2 -mabi=n64 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=N64 | ||
// RUN: %clang -target mips64-unknown-linux -O2 -mabi=n32 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=N32 | ||
// RUN: %clang -target mips-unknown-linux -O2 -mabi=o32 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=O32 | ||
|
||
#include <stdarg.h> | ||
|
||
unsigned foo(int x, ...) { | ||
va_list valist; | ||
va_start(valist, x); | ||
unsigned a; | ||
a = va_arg(valist, unsigned); | ||
return a; | ||
} | ||
|
||
void foo1() { | ||
unsigned f = 0xffffffe0; | ||
foo(1,f); | ||
} | ||
|
||
//N64: call i32 (i32, ...) @foo(i32 signext undef, i32 signext -32) | ||
//N32: call i32 (i32, ...) @foo(i32 signext undef, i32 signext -32) | ||
//O32: call i32 (i32, ...) @foo(i32 signext undef, i32 signext -32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// RUN: %clang -target mips64-unknown-linux -O0 -mabi=n64 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=N64 | ||
// RUN: %clang -target mips64-unknown-linux -O0 -mabi=n32 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=N32 | ||
// RUN: %clang -target mips-unknown-linux -O0 -mabi=o32 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=O32 | ||
|
||
void foo(unsigned a) { | ||
} | ||
|
||
void foo1() { | ||
unsigned f = 0xffffffe0; | ||
foo(f); | ||
} | ||
|
||
// N64: call void @foo(i32 signext %0) | ||
// N32: call void @foo(i32 signext %0) | ||
// O32: call void @foo(i32 signext %0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters