This repository has been archived by the owner on Aug 22, 2019. It is now read-only.
-
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.
[GR-10656] Support for testing bitcode targetted for avx2.
PullRequest: sulong/591
- Loading branch information
Showing
8 changed files
with
116 additions
and
34 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
18 changes: 0 additions & 18 deletions
18
tests/com.oracle.truffle.llvm.tests.sulong/c/builtin_gcc/__builtin_shufflevector.c
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
tests/com.oracle.truffle.llvm.tests.sulongavx/avx/avx2fallback.h
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,19 @@ | ||
/* | ||
* Helper for test cases that use AVX2 processor features. If a test case uses | ||
* AVX2 instructions, include this file, and implement the `avx2_fallback` | ||
* method. In the reference executable, this function will be used as fallback | ||
* when AVX2 is not supported. On Sulong, the AVX2 function will be emulated. | ||
*/ | ||
|
||
#include <signal.h> | ||
|
||
int avx2_fallback(); | ||
|
||
void __handle_sigill() { | ||
int ret = avx2_fallback(); | ||
exit(ret); | ||
} | ||
|
||
__attribute__((constructor)) void __install_sigill() { | ||
signal(SIGILL, __handle_sigill); | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/com.oracle.truffle.llvm.tests.sulongavx/avx/builtin_gcc/__builtin_shufflevector.c
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 @@ | ||
#include <stdio.h> | ||
#include "../avx2fallback.h" | ||
|
||
int avx2_fallback() { | ||
printf("v3: -1 -1 -1 -1\n"); | ||
printf("v4: -5 2 8 -1\n"); | ||
return 0; | ||
} | ||
|
||
typedef int vec4 __attribute__((vector_size(16))); | ||
|
||
int main() { | ||
volatile vec4 v1 = { -1, 8, 2, -5 }; | ||
|
||
volatile vec4 v3 = __builtin_shufflevector(v1, v1, 0, 0, 0, 0); | ||
printf("v3: %d %d %d %d\n", v3[0], v3[1], v3[2], v3[3]); | ||
|
||
volatile vec4 v4 = __builtin_shufflevector(v1, v1, 3, 2, 1, 0); | ||
printf("v4: %d %d %d %d\n", v4[0], v4[1], v4[2], v4[3]); | ||
|
||
return 0; | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/com.oracle.truffle.llvm.tests.sulongavx/avx/intrinsics/byteswap.c
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,21 @@ | ||
// Generates uses of @llvm.bswap.v8i32 (vectorised byte swaps) | ||
|
||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
#define SWAP(n) (((n) << 24) | (((n)&0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) | ||
|
||
int main(int argc, char **argv) { | ||
// Avoid LLVM pre-calculating everything at compile time. | ||
srand(time(0)); | ||
unsigned int x[16]; | ||
for (int i = 0; i < 16; i++) | ||
x[i] = rand(); | ||
unsigned int *buf = &x[0]; | ||
for (int i = 0; i < 16; i++) { | ||
*buf = SWAP(*buf); | ||
buf++; | ||
} | ||
volatile unsigned int y = x[0]; | ||
exit(0); | ||
} |