forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into sym-1.38.x
Conflicts: packaging/reggae_version
- Loading branch information
Showing
8 changed files
with
143 additions
and
26 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
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,35 @@ | ||
// Test that @target attribute overrides command line -mattr | ||
|
||
// REQUIRES: target_X86 | ||
|
||
// RUN: %ldc -O -c -mattr=sse -mcpu=i386 -mtriple=i386-linux-gnu -output-ll -of=%t.sse.ll %s && FileCheck %s --check-prefix LLVM-SSE < %t.sse.ll | ||
// RUN: %ldc -O -c -mattr=-sse -mcpu=i386 -mtriple=i386-linux-gnu -output-ll -of=%t.nosse.ll %s && FileCheck %s --check-prefix LLVM-NOSSE < %t.nosse.ll | ||
|
||
import ldc.attributes; | ||
|
||
// LLVM-SSE-LABEL: define{{.*}} void @{{.*}}foo_nosse | ||
// LLVM-SSE-SAME: #[[NOSSE:[0-9]+]] | ||
// LLVM-NOSSE-LABEL: define{{.*}} void @{{.*}}foo_nosse | ||
// LLVM-NOSSE-SAME: #[[NOSSE:[0-9]+]] | ||
@target("no-sse") | ||
void foo_nosse(float *A, float *B, float K) { | ||
for (int i = 0; i < 128; ++ i) | ||
A[i] *= B[i] + K; | ||
} | ||
|
||
// LLVM-SSE-LABEL: define{{.*}} void @{{.*}}foo_sse | ||
// LLVM-SSE-SAME: #[[SSE:[0-9]+]] | ||
// LLVM-NOSSE-LABEL: define{{.*}} void @{{.*}}foo_sse | ||
// LLVM-NOSSE-SAME: #[[SSE:[0-9]+]] | ||
@target("sse") | ||
void foo_sse(float *A, float *B, float K) { | ||
for (int i = 0; i < 128; ++ i) | ||
A[i] *= B[i] + K; | ||
} | ||
|
||
// The -mattr feature should come before the @target one in the "target-features" below. | ||
|
||
// LLVM-SSE-DAG: attributes #[[SSE]] = {{.*}} "target-features"="+sse,+sse" | ||
// LLVM-SSE-DAG: attributes #[[NOSSE]] = {{.*}} "target-features"="+sse,-sse" | ||
// LLVM-NOSSE-DAG: attributes #[[SSE]] = {{.*}} "target-features"="-sse,+sse" | ||
// LLVM-NOSSE-DAG: attributes #[[NOSSE]] = {{.*}} "target-features"="-sse,-sse" |
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,35 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=24479 | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
1 | ||
2 | ||
--- | ||
*/ | ||
|
||
struct S | ||
{ | ||
@1 | ||
S opBinary(string op: "-")(S rhs) const pure nothrow @nogc | ||
{ | ||
return rhs; | ||
} | ||
@2 | ||
S opBinary(string op: "*")(S dur) const pure nothrow @nogc | ||
{ | ||
return dur; | ||
} | ||
} | ||
|
||
private enum hasExternalUDA(alias A) = is(A == External) || is(typeof(A) == External); | ||
|
||
void foo() | ||
{ | ||
static foreach (t; __traits(getOverloads, S, "opBinary", true)) | ||
static foreach(attr; __traits(getAttributes, t)) | ||
pragma(msg, attr); | ||
|
||
static assert(__traits(getOverloads, S, "opBinary", true).length == 2); | ||
alias A = __traits(getAttributes, __traits(getOverloads, S, "opBinary", true)[1]); | ||
} |
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,15 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=24505 | ||
|
||
// PERMUTE_ARGS: | ||
|
||
struct stat { int x; }; | ||
|
||
void __stat(int x, int y); | ||
#define stat(x, y) __stat(x, y) | ||
|
||
// reversed order: | ||
#define stat2(x, y) __stat(x, y) | ||
struct stat2 { int x; }; | ||
|
||
#undef stat | ||
#undef stat2 |