This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
forked from luqmana/llvm
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from glandium/rust-llvm-release-6-0-0
[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32
- Loading branch information
Showing
5 changed files
with
139 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
; When we accept small parameters on Windows, make sure we do not assume they | ||
; are zero or sign extended in memory or in registers. | ||
|
||
; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=WIN64 | ||
; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=WIN64 | ||
; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=WIN32 | ||
; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=WIN32 | ||
|
||
define void @call() { | ||
entry: | ||
%rv = call i32 @manyargs(i8 1, i16 2, i8 3, i16 4, i8 5, i16 6) | ||
ret void | ||
} | ||
|
||
define i32 @manyargs(i8 %a, i16 %b, i8 %c, i16 %d, i8 %e, i16 %f) { | ||
entry: | ||
%aa = sext i8 %a to i32 | ||
%bb = sext i16 %b to i32 | ||
%cc = zext i8 %c to i32 | ||
%dd = zext i16 %d to i32 | ||
%ee = zext i8 %e to i32 | ||
%ff = zext i16 %f to i32 | ||
%t0 = add i32 %aa, %bb | ||
%t1 = add i32 %t0, %cc | ||
%t2 = add i32 %t1, %dd | ||
%t3 = add i32 %t2, %ee | ||
%t4 = add i32 %t3, %ff | ||
ret i32 %t4 | ||
} | ||
|
||
; WIN64-LABEL: call: | ||
; WIN64-DAG: movw $6, 40(%rsp) | ||
; WIN64-DAG: movb $5, 32(%rsp) | ||
; WIN64-DAG: movb $1, %cl | ||
; WIN64-DAG: movw $2, %dx | ||
; WIN64-DAG: movb $3, %r8b | ||
; WIN64-DAG: movw $4, %r9w | ||
; WIN64: callq manyargs | ||
|
||
; WIN64-LABEL: manyargs: | ||
; WIN64-DAG: movsbl %cl, | ||
; WIN64-DAG: movswl %dx, | ||
; WIN64-DAG: movzbl %r8b, | ||
; WIN64-DAG: movzwl %r9w, | ||
; WIN64-DAG: movzbl 40(%rsp), | ||
; WIN64-DAG: movzwl 48(%rsp), | ||
; WIN64: retq | ||
|
||
|
||
; WIN32-LABEL: _call: | ||
; WIN32: pushl $6 | ||
; WIN32: pushl $5 | ||
; WIN32: pushl $4 | ||
; WIN32: pushl $3 | ||
; WIN32: pushl $2 | ||
; WIN32: pushl $1 | ||
; WIN32: calll _manyargs | ||
|
||
; WIN32-LABEL: _manyargs: | ||
; WIN32-DAG: movsbl 4(%esp), | ||
; WIN32-DAG: movswl 8(%esp), | ||
; WIN32-DAG: movzbl 12(%esp), | ||
; WIN32-DAG: movzwl 16(%esp), | ||
; WIN32-DAG: movzbl 20(%esp), | ||
; WIN32-DAG: movzwl 24(%esp), | ||
; WIN32: retl | ||
|
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,33 @@ | ||
; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s | ||
; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s | ||
|
||
define x86_fastcallcc i32 @pass_fast_bool(i1 inreg zeroext %b) { | ||
entry: | ||
%cond = select i1 %b, i32 66, i32 0 | ||
ret i32 %cond | ||
} | ||
|
||
; CHECK-LABEL: @pass_fast_bool@4: | ||
; CHECK-DAG: testb %cl, %cl | ||
; CHECK-DAG: movl $66, | ||
; CHECK: retl | ||
|
||
define x86_vectorcallcc i32 @pass_vector_bool(i1 inreg zeroext %b) { | ||
entry: | ||
%cond = select i1 %b, i32 66, i32 0 | ||
ret i32 %cond | ||
} | ||
|
||
; CHECK-LABEL: pass_vector_bool@@4: | ||
; CHECK-DAG: testb %cl, %cl | ||
; CHECK-DAG: movl $66, | ||
; CHECK: retl | ||
|
||
define zeroext i1 @ret_true() { | ||
entry: | ||
ret i1 true | ||
} | ||
|
||
; CHECK-LABEL: ret_true: | ||
; CHECK: movb $1, %al | ||
; CHECK: retl |
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,23 @@ | ||
; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=CHECK | ||
; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=CHECK | ||
|
||
define i32 @pass_bool(i1 zeroext %b) { | ||
entry: | ||
%cond = select i1 %b, i32 66, i32 0 | ||
ret i32 %cond | ||
} | ||
|
||
; CHECK-LABEL: pass_bool: | ||
; CHECK-DAG: testb %cl, %cl | ||
; CHECK-DAG: movl $66, | ||
; CHECK: cmovel {{.*}}, %eax | ||
; CHECK: retq | ||
|
||
define zeroext i1 @ret_true() { | ||
entry: | ||
ret i1 true | ||
} | ||
|
||
; CHECK-LABEL: ret_true: | ||
; CHECK: movb $1, %al | ||
; CHECK: retq |