-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[SystemZ][z/OS] __ptr32 support for z/OS #101696
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
53 changes: 53 additions & 0 deletions
53
clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-definitions.c
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,53 @@ | ||
| // RUN: %clang_cc1 -triple s390x-ibm-zos -emit-llvm < %s | FileCheck %s --check-prefix=PTR32-ZOS | ||
| // RUN: %clang_cc1 -triple s390x-ibm-linux -fzos-extensions -emit-llvm < %s | FileCheck %s --check-prefix=PTR32-LINUX | ||
| // RUN: %clang_cc1 -triple s390x-linux-gnu -fzos-extensions -emit-llvm < %s | FileCheck %s --check-prefix=PTR32-LINUX | ||
|
|
||
| void ptr32_declarations() { | ||
| // PTR32-ZOS-LABEL: @ptr32_declarations() | ||
| // PTR32-LINUX-LABEL: @ptr32_declarations() | ||
|
|
||
| // PTR32-ZOS: %p1 = alloca ptr addrspace(1), align 4 | ||
| // PTR32-LINUX-NOT: %p1 = alloca i8 addrspace(1)*, align 4 | ||
| // PTR32-LINUX: %p1 = alloca ptr, align 8 | ||
| char * __ptr32 p1; | ||
|
|
||
| // PTR32-ZOS: %p2 = alloca ptr, align 8 | ||
| // PTR32-LINUX-NOT: %p2 = alloca ptr addrspace(1), align 8 | ||
| // PTR32-LINUX: %p2 = alloca ptr, align 8 | ||
| char * __ptr32 *p2; | ||
|
|
||
| // PTR32-ZOS: %p3 = alloca ptr addrspace(1), align 4 | ||
| // PTR32-LINUX-NOT: %p3 = alloca i8* addrspace(1)*, align 4 | ||
| // PTR32-LINUX: %p3 = alloca ptr, align 8 | ||
| char ** __ptr32 p3; | ||
|
|
||
| // PTR32-ZOS: %p4 = alloca ptr, align 8 | ||
| // PTR32-LINUX-NOT: %p4 = alloca ptr addrspace(1), align 8 | ||
| // PTR32-LINUX: %p4 = alloca ptr, align 8 | ||
| char ** __ptr32 *p4; | ||
|
|
||
| // PTR32-ZOS: %p5 = alloca ptr, align 8 | ||
| // PTR32-LINUX-NOT: %p5 = alloca ptr addrspace(1), align 8 | ||
| // PTR32-LINUX: %p5 = alloca ptr, align 8 | ||
| char *** __ptr32 *p5; | ||
|
|
||
| // PTR32-ZOS: %p6 = alloca ptr, align 8 | ||
| // PTR32-LINUX: %p6 = alloca ptr, align 8 | ||
| char **p6; | ||
|
|
||
| // PTR32-ZOS: %p7 = alloca ptr addrspace(1), align 4 | ||
| // PTR32-LINUX-NOT: %p7 = alloca i8 addrspace(1)* addrspace(1)*, align 4 | ||
| // PTR32-LINUX: %p7 = alloca ptr, align 8 | ||
| char * __ptr32 * __ptr32 p7; | ||
|
|
||
| // PTR32-ZOS: %p8 = alloca ptr addrspace(1), align 4 | ||
| // PTR32-LINUX-NOT: %p8 = alloca i8* addrspace(1)* addrspace(1)*, align 4 | ||
| // PTR32-LINUX: %p8 = alloca ptr, align 8 | ||
| char ** __ptr32 * __ptr32 p8; | ||
|
|
||
| // PTR32-ZOS: %p9 = alloca ptr, align 8 | ||
| // PTR32-LINUX-NOT: %p9 = alloca i8* addrspace(1)* addrspace(1)**, align 8 | ||
| // PTR32-LINUX: %p9 = alloca ptr, align 8 | ||
| char ** __ptr32 * __ptr32 *p9; | ||
|
|
||
| } |
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,84 @@ | ||
| // RUN: %clang -target s390x-ibm-zos -emit-llvm -S -O2 %s -o - | FileCheck %s --check-prefix=X64 | ||
| #include <stddef.h> | ||
| void *__malloc31(size_t); | ||
|
|
||
| int test_1() { | ||
| // X64-LABEL: define {{.*}} i32 @test_1() | ||
| // X64: ret i32 135 | ||
| int *__ptr32 a; | ||
| int *b; | ||
| int i; | ||
| int sum1, sum2, sum3; | ||
|
|
||
| a = (int *__ptr32)__malloc31(sizeof(int) * 10); | ||
|
|
||
| b = a; | ||
| sum1 = 0; | ||
| for (i = 0; i < 10; ++i) { | ||
| a[i] = i; | ||
| sum1 += i; | ||
| } | ||
|
|
||
| sum2 = 0; | ||
| for (i = 0; i < 10; ++i) { | ||
| sum2 += a[i]; | ||
| } | ||
| sum3 = 0; | ||
| for (i = 0; i < 10; ++i) { | ||
| sum3 += b[i]; | ||
| } | ||
|
|
||
| return (sum1 + sum2 + sum3); | ||
| } | ||
|
|
||
| int test_2() { | ||
| // X64-LABEL: define {{.*}} i32 @test_2() | ||
| // X64: ret i32 4 | ||
| int *a = (int *)__malloc31(sizeof(int)); | ||
| int *__ptr32 b; | ||
|
|
||
| *a = 99; | ||
| b = a; | ||
| *b = 44; | ||
|
|
||
| // Test should return 4 | ||
| return (*b - 40); | ||
| } | ||
|
|
||
| int test_3() { | ||
| // X64-LABEL: define {{.*}} i32 @test_3() | ||
| // X64: ret i32 4 | ||
| int *a = (int *)__malloc31(sizeof(int)); | ||
| int *__ptr32 b; | ||
|
|
||
| *a = 99; | ||
| b = a; | ||
|
|
||
| // Test should return 4 | ||
| return (*b - 95); | ||
| } | ||
|
|
||
| int test_4() { | ||
| // X64-LABEL: define {{.*}} i32 @test_4() | ||
| // X64: ret i32 1 | ||
| int *a = (int *)__malloc31(sizeof(int)); | ||
| float *d = (float *)__malloc31(sizeof(float)); | ||
|
|
||
| int *__ptr32 b; | ||
| int *c; | ||
|
|
||
| float *__ptr32 e; | ||
| float *f; | ||
|
|
||
| *a = 0; | ||
| *d = 0.0; | ||
|
|
||
| b = a; | ||
| c = a; | ||
| e = d; | ||
| f = d; | ||
|
|
||
| // Test should return 1 | ||
| return (b == c && e == f); | ||
| } | ||
|
|
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.
Uh oh!
There was an error while loading. Please reload this page.