mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
[mips] Promote i32 arguments to i64 for the N32/N64 ABI and fix <64-bit structs...
Summary: ... and after all that refactoring, it's possible to distinguish softfloat floating point values from integers so this patch no longer breaks softfloat to do it. Remove direct handling of i32's in the N32/N64 ABI by promoting them to i64. This more closely reflects the ABI documentation and also fixes problems with stack arguments on big-endian targets. We now rely on signext/zeroext annotations (already generated by clang) and the Assert[SZ]ext nodes to avoid the introduction of unnecessary sign/zero extends. It was not possible to convert three tests to use signext/zeroext. These tests are bswap.ll, ctlz-v.ll, ctlz-v.ll. It's not possible to put signext on a vector type so we just accept the sign extends here for now. These tests don't pass the vectors the same way clang does (clang puts multiple elements in the same argument, these map 1 element to 1 argument) so we don't need to worry too much about it. With this patch, all known N32/N64 bugs should be fixed and we now pass the first 10,000 tests generated by ABITest.py. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6117 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221534 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
; 64-CMP-DAG: or $[[T2:[0-9]+]], $[[T0]], $[[T1]]
|
||||
; 64-CMP-DAG: ld $2, 0($[[T2]])
|
||||
|
||||
define i32* @cmov1(i32 %s) nounwind readonly {
|
||||
define i32* @cmov1(i32 signext %s) nounwind readonly {
|
||||
entry:
|
||||
%tobool = icmp ne i32 %s, 0
|
||||
%tmp1 = load i32** @i3, align 4
|
||||
@@ -78,7 +78,7 @@ entry:
|
||||
; 64-CMP-DAG: or $[[T2:[0-9]+]], $[[T0]], $[[T1]]
|
||||
; 64-CMP-DAG: lw $2, 0($[[T2]])
|
||||
|
||||
define i32 @cmov2(i32 %s) nounwind readonly {
|
||||
define i32 @cmov2(i32 signext %s) nounwind readonly {
|
||||
entry:
|
||||
%tobool = icmp ne i32 %s, 0
|
||||
%tmp1 = load i32* @c, align 4
|
||||
@@ -109,7 +109,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $6, $[[CC]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @cmov3(i32 %a, i32 %b, i32 %c) nounwind readnone {
|
||||
define i32 @cmov3(i32 signext %a, i32 signext %b, i32 signext %c) nounwind readnone {
|
||||
entry:
|
||||
%cmp = icmp eq i32 %a, 234
|
||||
%cond = select i1 %cmp, i32 %b, i32 %c
|
||||
@@ -142,7 +142,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $6, $[[CC]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @cmov3_ne(i32 %a, i32 %b, i32 %c) nounwind readnone {
|
||||
define i32 @cmov3_ne(i32 signext %a, i32 signext %b, i32 signext %c) nounwind readnone {
|
||||
entry:
|
||||
%cmp = icmp ne i32 %a, 234
|
||||
%cond = select i1 %cmp, i32 %b, i32 %c
|
||||
@@ -179,7 +179,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $6, $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i64 @cmov4(i32 %a, i64 %b, i64 %c) nounwind readnone {
|
||||
define i64 @cmov4(i32 signext %a, i64 %b, i64 %c) nounwind readnone {
|
||||
entry:
|
||||
%cmp = icmp eq i32 %a, 234
|
||||
%cond = select i1 %cmp, i64 %b, i64 %c
|
||||
@@ -220,7 +220,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $6, $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i64 @cmov4_ne(i32 %a, i64 %b, i64 %c) nounwind readnone {
|
||||
define i64 @cmov4_ne(i32 signext %a, i64 %b, i64 %c) nounwind readnone {
|
||||
entry:
|
||||
%cmp = icmp ne i32 %a, 234
|
||||
%cond = select i1 %cmp, i64 %b, i64 %c
|
||||
@@ -263,7 +263,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @slti0(i32 %a) {
|
||||
define i32 @slti0(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %a, 32766
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -302,7 +302,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @slti1(i32 %a) {
|
||||
define i32 @slti1(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %a, 32767
|
||||
%cond = select i1 %cmp, i32 7, i32 5
|
||||
@@ -337,7 +337,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @slti2(i32 %a) {
|
||||
define i32 @slti2(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %a, -32769
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -380,7 +380,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @slti3(i32 %a) {
|
||||
define i32 @slti3(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %a, -32770
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -567,7 +567,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @sltiu0(i32 %a) {
|
||||
define i32 @sltiu0(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp ugt i32 %a, 32766
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -606,7 +606,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @sltiu1(i32 %a) {
|
||||
define i32 @sltiu1(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp ugt i32 %a, 32767
|
||||
%cond = select i1 %cmp, i32 7, i32 5
|
||||
@@ -641,7 +641,7 @@ entry:
|
||||
; 64-CMP-DAG: selnez $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @sltiu2(i32 %a) {
|
||||
define i32 @sltiu2(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp ugt i32 %a, -32769
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -684,7 +684,7 @@ entry:
|
||||
; 64-CMP-DAG: seleqz $[[T1:[0-9]+]], $[[I5]], $[[R0]]
|
||||
; 64-CMP-DAG: or $2, $[[T0]], $[[T1]]
|
||||
|
||||
define i32 @sltiu3(i32 %a) {
|
||||
define i32 @sltiu3(i32 signext %a) {
|
||||
entry:
|
||||
%cmp = icmp ugt i32 %a, -32770
|
||||
%cond = select i1 %cmp, i32 3, i32 5
|
||||
@@ -697,7 +697,7 @@ entry:
|
||||
; doesn't generate conditional moves
|
||||
; for constant operands whose difference is |1|
|
||||
|
||||
define i32 @slti4(i32 %a) nounwind readnone {
|
||||
define i32 @slti4(i32 signext %a) nounwind readnone {
|
||||
%1 = icmp slt i32 %a, 7
|
||||
%2 = select i1 %1, i32 4, i32 3
|
||||
ret i32 %2
|
||||
@@ -723,7 +723,7 @@ define i32 @slti4(i32 %a) nounwind readnone {
|
||||
; 64-CMP-NOT: seleqz
|
||||
; 64-CMP-NOT: selnez
|
||||
|
||||
define i32 @slti5(i32 %a) nounwind readnone {
|
||||
define i32 @slti5(i32 signext %a) nounwind readnone {
|
||||
%1 = icmp slt i32 %a, 7
|
||||
%2 = select i1 %1, i32 -3, i32 -4
|
||||
ret i32 %2
|
||||
@@ -749,7 +749,7 @@ define i32 @slti5(i32 %a) nounwind readnone {
|
||||
; 64-CMP-NOT: seleqz
|
||||
; 64-CMP-NOT: selnez
|
||||
|
||||
define i32 @slti6(i32 %a) nounwind readnone {
|
||||
define i32 @slti6(i32 signext %a) nounwind readnone {
|
||||
%1 = icmp slt i32 %a, 7
|
||||
%2 = select i1 %1, i32 3, i32 4
|
||||
ret i32 %2
|
||||
|
||||
Reference in New Issue
Block a user