forked from gcc-mirror/gcc
-
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.
* config/arm/arm.c (arm_sat_operator_match): New function. * config/arm/arm-protos.h (arm_sat_operator_match): Add prototype. * config/arm/arm.md ("insn" attribute): Add "sat" value. ("SAT", "SATrev"): New code iterators. ("SATlo", "SAThi"): New code iterator attributes. ("*satsi_<SAT:code>"): New pattern. ("*satsi_<SAT:code>_shift"): Likewise. * config/arm/arm-fixed.md ("arm_ssatsihi_shift"): Add "insn" and "shift" attributes. ("arm_usatsihi"): Add "insn" attribute. * config/arm/predicates.md (sat_shift_operator): Allow multiplication by powers of two. Do not allow shift by 32. gcc/testsuite/ * gcc.target/arm/sat-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184803 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
uweigand
committed
Mar 2, 2012
1 parent
7103ce4
commit b49e374
Showing
8 changed files
with
184 additions
and
5 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
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,64 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-require-effective-target arm_arm_ok } */ | ||
/* { dg-require-effective-target arm_arch_v6_ok } */ | ||
/* { dg-options "-O2 -marm" } */ | ||
/* { dg-add-options arm_arch_v6 } */ | ||
|
||
|
||
static inline int sat1 (int a, int amin, int amax) | ||
{ | ||
if (a < amin) return amin; | ||
else if (a > amax) return amax; | ||
else return a; | ||
} | ||
|
||
static inline int sat2 (int a, int amin, int amax) | ||
{ | ||
if (a > amax) return amax; | ||
else if (a < amin) return amin; | ||
else return a; | ||
} | ||
|
||
int u1 (int x) | ||
{ | ||
return sat1 (x, 0, 63); | ||
} | ||
|
||
int us1 (int x) | ||
{ | ||
return sat1 (x >> 5, 0, 63); | ||
} | ||
|
||
int s1 (int x) | ||
{ | ||
return sat1 (x, -64, 63); | ||
} | ||
|
||
int ss1 (int x) | ||
{ | ||
return sat1 (x >> 5, -64, 63); | ||
} | ||
|
||
int u2 (int x) | ||
{ | ||
return sat2 (x, 0, 63); | ||
} | ||
|
||
int us2 (int x) | ||
{ | ||
return sat2 (x >> 5, 0, 63); | ||
} | ||
|
||
int s2 (int x) | ||
{ | ||
return sat2 (x, -64, 63); | ||
} | ||
|
||
int ss2 (int x) | ||
{ | ||
return sat2 (x >> 5, -64, 63); | ||
} | ||
|
||
/* { dg-final { scan-assembler-times "usat" 4 } } */ | ||
/* { dg-final { scan-assembler-times "ssat" 4 } } */ | ||
|