Skip to content

Commit 573db6c

Browse files
author
Claudiu Zissulescu
committed
Update condition when the address is mode dependent.
1 parent e94b49b commit 573db6c

File tree

4 files changed

+121
-13
lines changed

4 files changed

+121
-13
lines changed

gcc/ChangeLog.ARC

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2013-04-02 Claudiu Zissulescu <[email protected]>
2+
3+
* config/arc/arc.c (arc_mode_dependent_address_p): Update
4+
condition when the address is mode dependent.
5+
(__builtin_arc_trap_s): Enable builtin for ARCv2.
6+
* doc/extend.texi: Update document.
7+
* testsuite/gcc.target/arc/pr9000727530.c: New test.
8+
19
2013-03-28 Claudiu Zissulescu <[email protected]>
210

311
* config/arc/arc.md (movsi_ne): Update pattern.

gcc/config/arc/arc.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5407,17 +5407,15 @@ arc_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
54075407
has an effect that depends on the machine mode it is used for. */
54085408

54095409
static bool
5410-
arc_mode_dependent_address_p (const_rtx addr, addr_space_t)
5410+
arc_mode_dependent_address_p (const_rtx addr,
5411+
addr_space_t addrspace ATTRIBUTE_UNUSED)
54115412
{
54125413
/* SYMBOL_REF is not mode dependent: it is either a small data reference,
54135414
which is valid for loads and stores, or a limm offset, which is valid for
54145415
loads. */
5415-
/* Scaled indices are scaled by the access mode; likewise for scaled
5416-
offsets, which are needed for maximum offset stores. */
5416+
/* Scaled indices are scaled by the access mode. */
54175417
if (GET_CODE (addr) == PLUS
5418-
&& (GET_CODE (XEXP ((addr), 0)) == MULT
5419-
|| (CONST_INT_P (XEXP ((addr), 1))
5420-
&& !SMALL_INT (INTVAL (XEXP ((addr), 1))))))
5418+
&& GET_CODE (XEXP ((addr), 0)) == MULT)
54215419
return true;
54225420
return false;
54235421
}
@@ -5519,7 +5517,7 @@ arc_init_builtins (void)
55195517
def_mbuiltin (1,"__builtin_arc_core_write", void_ftype_usint_usint, ARC_BUILTIN_CORE_WRITE);
55205518
def_mbuiltin (1,"__builtin_arc_lr", usint_ftype_usint, ARC_BUILTIN_LR);
55215519
def_mbuiltin (1,"__builtin_arc_sr", void_ftype_usint_usint, ARC_BUILTIN_SR);
5522-
def_mbuiltin (TARGET_ARC700,"__builtin_arc_trap_s", void_ftype_usint, ARC_BUILTIN_TRAP_S);
5520+
def_mbuiltin (TARGET_ARC700 || TARGET_V2,"__builtin_arc_trap_s", void_ftype_usint, ARC_BUILTIN_TRAP_S);
55235521
def_mbuiltin (TARGET_ARC700 || TARGET_V2,"__builtin_arc_unimp_s", void_ftype_void, ARC_BUILTIN_UNIMP_S);
55245522
def_mbuiltin (1,"__builtin_arc_aligned", int_ftype_pcvoid_int, ARC_BUILTIN_ALIGNED);
55255523

@@ -10768,7 +10766,7 @@ arc_variable_issue (FILE *dump ATTRIBUTE_UNUSED,
1076810766

1076910767
int unit = -1;
1077010768
int old_unit = -1;
10771-
switch (arc_attr_type(insn))
10769+
switch (arc_attr_type (insn))
1077210770
{
1077310771
case TYPE_MOVE:
1077410772
case TYPE_CMOVE:

gcc/doc/extend.texi

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8934,7 +8934,7 @@ brk
89348934
@end deftypefn
89358935

89368936
@deftypefn {Built-in Function} void __builtin_arc_clri (unsigned int @var{c})
8937-
Only valid with @option{-mcpu=ARCv2EM}. Generates
8937+
Only valid for ARCv2 architecture. Generates
89388938
@example
89398939
clri @var{c}
89408940
@end example
@@ -8960,7 +8960,7 @@ mov r@var{regno}, @var{val}
89608960

89618961
@deftypefn {Built-in Function} int __builtin_arc_divaw (int @var{a}, int @var{b})
89628962
Only available with either @option{-mcpu=ARC700} or @option{-mea} is set, and
8963-
never with @option{-mcpu=ARCv2EM}. Generates:
8963+
never ARCv2 architecture. Generates:
89648964
@example
89658965
divaw @var{dest}, @var{a}, @var{b}
89668966
@end example
@@ -8969,7 +8969,8 @@ built-in.
89698969
@end deftypefn
89708970

89718971
@deftypefn {Built-in Function} int __builtin_arc_ffs (int @var{a})
8972-
Only valid with @option{-mcpu=ARCv2EM} and @option{-mnorm}. Generates:
8972+
Only valid with @option{-mcpu=ARCv2EM} and @option{-mnorm}, or with
8973+
@option{-mcpu=ARCv2HS}. Generates:
89738974
@example
89748975
ffs @var{dest}, @var{a}
89758976
@end example
@@ -8985,7 +8986,8 @@ flag @var{a}
89858986
@end deftypefn
89868987

89878988
@deftypefn {Built-in Function} int __builtin_arc_fls (int @var{a})
8988-
Only valid with @option{-mcpu=ARCv2EM} and @option{-mnorm}. Generates:
8989+
Only valid with @option{-mcpu=ARCv2EM} and @option{-mnorm}, or with
8990+
@option{-mcpu=ARCv2HS}. Generates:
89898991
@example
89908992
fls @var{dest}, @var{a}
89918993
@end example
@@ -8994,7 +8996,7 @@ built-in.
89948996
@end deftypefn
89958997

89968998
@deftypefn {Built-in Function} void __builtin_arc_kflag (unsigned int @var{cc})
8997-
Only valid with @option{-mcpu=ARCv2EM}. Generates:
8999+
Only valid for ARCv2 architecture. Generates:
89989000
@example
89999001
kflag @var{cc}
90009002
@end example
@@ -9015,13 +9017,15 @@ Only available with @option{-mmul64}. Generates:
90159017
@example
90169018
mul64 @var{a}, @var{b}
90179019
@end example
9020+
This builtin is deprecated.
90189021
@end deftypefn
90199022

90209023
@deftypefn {Built-in Function} void __builtin_arc_mulu64 (unsigned int @var{a}, unsigned int @var{b})
90219024
Only available with @option{-mmul64}. Generates:
90229025
@example
90239026
mulu64 @var{a}, @var{b}
90249027
@end example
9028+
This builtin is deprecated.
90259029
@end deftypefn
90269030

90279031
@deftypefn {Built-in Function} void __builtin_arc_nop (void)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-Os" } */
3+
/* The expand pass generates a subreg of mem, where the address is a
4+
function of virtual-stack-vars. The vregs step fails to convert the
5+
virtual-stack-vars to an fp/sp register, hence, the compiler crashes
6+
when checking the instruction constrains. */
7+
8+
#include "stdio.h"
9+
10+
char *outfile;
11+
12+
_Bool reverse;
13+
static FILE *rejfp;
14+
static char *rejname;
15+
16+
struct outstate
17+
{
18+
FILE *ofp;
19+
_Bool after_newline;
20+
_Bool zero_output;
21+
};
22+
23+
struct __longlong_aligned { long long x; };
24+
25+
struct stat
26+
{
27+
unsigned long long st_dev;
28+
unsigned long long st_ino;
29+
unsigned long long st_rdev;
30+
unsigned long long _pad1;
31+
long long st_size;
32+
int st_blksize;
33+
int __pad2;
34+
long long st_blocks;
35+
struct timespec st_atim;
36+
struct timespec st_mtim;
37+
struct timespec st_ctim;
38+
unsigned int __unused4;
39+
unsigned int __unused5;
40+
} __attribute__((aligned(__alignof__(struct __longlong_aligned))));
41+
42+
enum diff
43+
{
44+
NO_DIFF,
45+
CONTEXT_DIFF,
46+
NORMAL_DIFF,
47+
ED_DIFF,
48+
NEW_CONTEXT_DIFF,
49+
UNI_DIFF,
50+
GIT_BINARY_DIFF
51+
};
52+
53+
enum diff diff_type;
54+
55+
int
56+
foo (int x)
57+
{
58+
struct outstate outstate;
59+
struct stat tmpoutst;
60+
mode_t file_type;
61+
int outfd = -1;
62+
int failed = 0;
63+
64+
tmpoutst.st_size = -1;
65+
if (diff_type == ED_DIFF)
66+
{
67+
outstate.zero_output = 0;
68+
if (! outfile )
69+
{
70+
fstat (outfd, &tmpoutst);
71+
outstate.zero_output = tmpoutst.st_size == 0;
72+
}
73+
}
74+
else
75+
{
76+
failed++;
77+
}
78+
79+
if (outstate.zero_output
80+
&& ((pch_says_nonexistent (! reverse) == 2)
81+
|| ((((file_type)) & 0170000) == (0120000))))
82+
{
83+
struct stat rejst;
84+
85+
if (fstat (fileno (rejfp), &rejst) != 0)
86+
{
87+
char *rej = rejname;
88+
if (rejname)
89+
{
90+
struct stat oldst;
91+
int olderrno;
92+
93+
olderrno = stat_file (rej, &oldst);
94+
}
95+
}
96+
}
97+
return 0;
98+
}

0 commit comments

Comments
 (0)