forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Arm64_32 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TNorthover
wants to merge
16
commits into
main
Choose a base branch
from
arm64_32
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Arm64_32 #1
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
446fa0c
CodeGenPrep: sink GEPs as GEPs and preserve inbounds note.
TNorthover 33abee7
AArch64: support binutils-like things on arm64_32.
TNorthover 5305e7c
DAG: allow DAG pointer size different from memory representation.
TNorthover a61a111
DAG: propagate whether an arg is a pointer for CallingConv decisions.
TNorthover 745b7e1
DAG: propagate ConsecutiveRegs flags to returns too.
TNorthover 488d84b
AArch64: support arm64_32, an ILP32 slice for watchOS.
TNorthover e58a1c5
AArch64: add compatibility modules to convert armv7k bitcode to arm64…
TNorthover f514a52
AArch64: add arm64_32 support to Clang.
TNorthover a4c4f01
arm64_32: support function return in FastISel.
TNorthover 623490a
arm64_32: support function calls in FastISel.
TNorthover f174332
arm64_32: support loads in FastISel
TNorthover 8b18dfd
arm64_32: support stores in FastISel
TNorthover 591f098
arm64_32: support GEP in FastISel
TNorthover 91184bb
arm64_32: support compares in FastISel
TNorthover f35246d
arm64_32: support select in FastISel.
TNorthover 563c5b8
arm64_32: support compiler-rt and sanitizers
TNorthover File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,117 @@ | ||
// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs -emit-llvm -o - -O1 -ffreestanding %s | FileCheck %s | ||
|
||
#include <stdarg.h> | ||
|
||
typedef struct { | ||
int a; | ||
} OneInt; | ||
|
||
// No realignment should be needed here: slot size is 4 bytes. | ||
int test_int(OneInt input, va_list *mylist) { | ||
// CHECK-LABEL: define i32 @test_int(i32 %input | ||
// CHECK: [[START:%.*]] = load i8*, i8** %mylist | ||
// CHECK: [[NEXT:%.*]] = getelementptr inbounds i8, i8* [[START]], i32 4 | ||
// CHECK: store i8* [[NEXT]], i8** %mylist | ||
|
||
// CHECK: [[ADDR_I32:%.*]] = bitcast i8* [[START]] to i32* | ||
// CHECK: [[RES:%.*]] = load i32, i32* [[ADDR_I32]] | ||
// CHECK: ret i32 [[RES]] | ||
|
||
return va_arg(*mylist, OneInt).a; | ||
} | ||
|
||
|
||
typedef struct { | ||
long long a; | ||
} OneLongLong; | ||
|
||
// Minimum slot size is 4 bytes, so address needs rounding up to multiple of 8. | ||
long long test_longlong(OneLongLong input, va_list *mylist) { | ||
// CHECK-LABEL: define i64 @test_longlong(i64 %input | ||
// CHECK: [[STARTPTR:%.*]] = bitcast i8** %mylist to i32* | ||
// CHECK: [[START:%.*]] = load i32, i32* [[STARTPTR]] | ||
|
||
// CHECK: [[ALIGN_TMP:%.*]] = add i32 [[START]], 7 | ||
// CHECK: [[ALIGNED:%.*]] = and i32 [[ALIGN_TMP]], -8 | ||
// CHECK: [[ALIGNED_ADDR:%.*]] = inttoptr i32 [[ALIGNED]] to i8* | ||
// CHECK: [[NEXT:%.*]] = getelementptr inbounds i8, i8* [[ALIGNED_ADDR]], i32 8 | ||
// CHECK: store i8* [[NEXT]], i8** %mylist | ||
|
||
// CHECK: [[ADDR_STRUCT:%.*]] = inttoptr i32 [[ALIGNED]] to %struct.OneLongLong* | ||
// CHECK: [[ADDR_I64:%.*]] = getelementptr inbounds %struct.OneLongLong, %struct.OneLongLong* [[ADDR_STRUCT]], i32 0, i32 0 | ||
// CHECK: [[RES:%.*]] = load i64, i64* [[ADDR_I64]] | ||
// CHECK: ret i64 [[RES]] | ||
|
||
return va_arg(*mylist, OneLongLong).a; | ||
} | ||
|
||
|
||
typedef struct { | ||
float arr[4]; | ||
} HFA; | ||
|
||
// HFAs take priority over passing large structs indirectly. | ||
float test_hfa(va_list *mylist) { | ||
// CHECK-LABEL: define float @test_hfa | ||
// CHECK: [[START:%.*]] = load i8*, i8** %mylist | ||
|
||
// CHECK: [[NEXT:%.*]] = getelementptr inbounds i8, i8* [[START]], i32 16 | ||
// CHECK: store i8* [[NEXT]], i8** %mylist | ||
|
||
// CHECK: [[ADDR_FLOAT:%.*]] = bitcast i8* [[START]] to float* | ||
// CHECK: [[RES:%.*]] = load float, float* [[ADDR_FLOAT]] | ||
// CHECK: ret float [[RES]] | ||
|
||
return va_arg(*mylist, HFA).arr[0]; | ||
} | ||
|
||
// armv7k does not return HFAs normally for variadic functions, so we must match | ||
// that. | ||
HFA test_hfa_return(int n, ...) { | ||
// CHECK-LABEL: define [2 x i64] @test_hfa_return | ||
HFA h = {0}; | ||
return h; | ||
} | ||
|
||
typedef struct { | ||
long long a, b; | ||
char c; | ||
} BigStruct; | ||
|
||
// Structs bigger than 16 bytes are passed indirectly: a pointer is placed on | ||
// the stack. | ||
long long test_bigstruct(BigStruct input, va_list *mylist) { | ||
// CHECK-LABEL: define i64 @test_bigstruct(%struct.BigStruct* | ||
// CHECK: [[START:%.*]] = load i8*, i8** %mylist | ||
// CHECK: [[NEXT:%.*]] = getelementptr inbounds i8, i8* [[START]], i32 4 | ||
// CHECK: store i8* [[NEXT]], i8** %mylist | ||
|
||
// CHECK: [[INT_PTR:%.*]] = bitcast i8* [[START]] to %struct.BigStruct** | ||
// CHECK: [[ADDR:%.*]] = load %struct.BigStruct*, %struct.BigStruct** [[INT_PTR]] | ||
// CHECK: [[ADDR_I64:%.*]] = getelementptr inbounds %struct.BigStruct, %struct.BigStruct* [[ADDR]], i32 0, i32 0 | ||
// CHECK: [[RES:%.*]] = load i64, i64* [[ADDR_I64]] | ||
// CHECK: ret i64 [[RES]] | ||
|
||
return va_arg(*mylist, BigStruct).a; | ||
} | ||
|
||
typedef struct { | ||
short arr[3]; | ||
} ThreeShorts; | ||
|
||
// Slot sizes are 4-bytes on arm64_32, so structs with less than 32-bit | ||
// alignment must be passed via "[N x i32]" to be correctly allocated in the | ||
// backend. | ||
short test_threeshorts(ThreeShorts input, va_list *mylist) { | ||
// CHECK-LABEL: define signext i16 @test_threeshorts([2 x i32] %input | ||
|
||
// CHECK: [[START:%.*]] = load i8*, i8** %mylist | ||
// CHECK: [[NEXT:%.*]] = getelementptr inbounds i8, i8* [[START]], i32 8 | ||
// CHECK: store i8* [[NEXT]], i8** %mylist | ||
|
||
// CHECK: [[ADDR_I32:%.*]] = bitcast i8* [[START]] to i16* | ||
// CHECK: [[RES:%.*]] = load i16, i16* [[ADDR_I32]] | ||
// CHECK: ret i16 [[RES]] | ||
|
||
return va_arg(*mylist, ThreeShorts).arr[0]; | ||
} |
This file contains hidden or 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,30 @@ | ||
// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -emit-llvm -o - %s | FileCheck %s | ||
|
||
struct Foo { | ||
char a; | ||
int b : 1; | ||
}; | ||
|
||
int BitfieldOffset = sizeof(struct Foo); | ||
// CHECK: @BitfieldOffset = global i32 2 | ||
|
||
int PointerSize = sizeof(void *); | ||
// CHECK: @PointerSize = global i32 4 | ||
|
||
int PointerAlign = __alignof(void *); | ||
// CHECK: @PointerAlign = global i32 4 | ||
|
||
int LongSize = sizeof(long); | ||
// CHECK: @LongSize = global i32 4 | ||
|
||
int LongAlign = __alignof(long); | ||
// CHECK: @LongAlign = global i32 4 | ||
|
||
// Not expected to change, but it's a difference between AAPCS and DarwinPCS | ||
// that we need to be preserved for compatibility with ARMv7k. | ||
long double LongDoubleVar = 0.0; | ||
// CHECK: @LongDoubleVar = global double | ||
|
||
typedef float __attribute__((ext_vector_type(16))) v16f32; | ||
v16f32 func(v16f32 in) { return in; } | ||
// CHECK: define void @func(<16 x float>* noalias sret {{%.*}}, <16 x float> {{%.*}}) |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use this predicate a lot; is there a better way of expressing it now?