Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
16189740
Commit
16189740
authored
25 years ago
by
Richard Henderson
Committed by
Richard Henderson
25 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CCZmode.
From-SVN: r32777
parent
8e4b9c97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
23 deletions
+105
-23
gcc/ChangeLog
+38
-0
gcc/config/i386/i386-protos.h
+1
-0
gcc/config/i386/i386.c
+60
-20
gcc/config/i386/i386.h
+6
-3
gcc/config/i386/i386.md
+0
-0
No files found.
gcc/ChangeLog
View file @
16189740
2000
-
03
-
27
Richard
Henderson
<
rth
@cygnus
.
com
>
*
i386
-
protos
.
h
(
ix86_match_ccmode
)
:
Declare
.
*
i386
.
c
(
ix86_match_ccmode
)
:
New
.
(
ix86_expand_fp_compare
)
:
Update
for
pattern
renames
.
(
ix86_expand_strlensi_unroll_1
)
:
Likewise
.
*
i386
.
h
(
EXTRA_CC_MODES
)
:
Add
CCZ
.
(
SELECT_CC_MODE
)
:
Use
it
for
EQ
/
NE
zero
.
*
i386
.
md
(
cmpsi_ccz_1
)
:
New
.
(
cmpqi_ccz_1
)
:
New
.
(
*
testsi_ccz_1
)
:
New
.
(
testqi_ccz_1
)
:
New
.
(
cmpsi_ccno_1
)
:
Rename
from
cmpsi_0
.
(
testsi_ccno_1
)
:
Rename
from
testsi_1
.
(
testqi_ccno_1
)
:
Rename
from
testqi_1
.
(
*
testqi_ext_ccz_0
)
:
Rename
from
testqi_ext_0
.
(
testqi_ext_ccno_0
)
:
Rename
from
*
testqi_ext_1
.
(
*
cmphi_0
)
:
Use
ix86_match_ccmode
.
(
*
cmpqi_ext_2
,
*
addsi_2
,
*
addhi_2
,
*
addqi_2
)
:
Likewise
.
(
*
subsi_2
,
*
subhi_2
,
*
subqi_2
,
*
testhi_1
)
:
Likewise
.
(
*
testqi_ext_1
,
*
testqi_ext_2
,
*
testqi_ext_3
)
:
Likewise
.
(
*
andsi_2
,
*
andhi_2
,
*
andqi_2
,
*
andqi_ext_0_cc
)
:
Likewise
.
(
*
iorsi_2
,
*
iorhi_2
,
*
iorqi_2
)
:
Likewise
.
(
*
xorsi_2
,
*
xorhi_2
,
*
xorqi_cc_1
)
:
Likewise
.
(
*
one_cmplsi2_2
,
*
one_cmplhi2_2
,
*
one_cmplqi2_2
)
:
Likewise
.
(
*
ashlsi3_cmpno
,
*
ashlhi3_cmpno
,
*
ashlqi3_cmpno
)
:
Likewise
.
(
*
ashrsi3_cmpno
,
*
ashrhi3_cmpno
,
*
ashrqi3_cmpno
)
:
Likewise
.
(
*
lshrsi3_cmpno
,
*
lshrhi3_cmpno
,
*
lshrqi3_cmpno
)
:
Likewise
.
(
appropriate
peepholes
)
:
Likewise
.
(
*
cmphi_1
,
*
cmpqi_ccno_1
,
*
cmpqi_1
)
:
Star
out
name
.
(
*
subsi_3
,
*
subhi_3
,
*
subqi_3
)
:
Remove
.
(
*
negdi2_1
+
1
splitter
)
:
Use
CCZ
for
neg
patterns
.
(
*
negsi2_cmp
,
*
neghi2_cmp
,
*
negqi2_cmp
)
:
Remove
.
(
*
negsi2_cmpz
)
:
Rename
from
*
negsi2_cmpno
,
use
CCZ
.
(
*
neghi2_cmpz
,
*
negqi2_cmpz
)
:
Similarly
.
(
x86_shift_adj_1
)
:
Use
CCZ
.
(
*
dbra_ge
+
1
,
*
dbra_ge
+
2
,
ffssi2
,
ffssi_1
)
:
Likewise
.
2000
-
03
-
27
Stan
Cox
<
scox
@cygnus
.
com
>
*
resource
.
h
(
mark_resource_type
)
:
New
.
...
...
This diff is collapsed.
Click to expand it.
gcc/config/i386/i386-protos.h
View file @
16189740
...
...
@@ -96,6 +96,7 @@ extern void ix86_expand_unary_operator PARAMS ((enum rtx_code, enum machine_mode
rtx
[]));
extern
int
ix86_unary_operator_ok
PARAMS
((
enum
rtx_code
,
enum
machine_mode
,
rtx
[]));
extern
int
ix86_match_ccmode
PARAMS
((
rtx
,
enum
machine_mode
));
extern
void
ix86_expand_branch
PARAMS
((
enum
rtx_code
,
int
,
rtx
));
extern
int
ix86_expand_setcc
PARAMS
((
enum
rtx_code
,
int
,
rtx
));
extern
int
ix86_expand_int_movcc
PARAMS
((
rtx
[]));
...
...
This diff is collapsed.
Click to expand it.
gcc/config/i386/i386.c
View file @
16189740
...
...
@@ -1373,7 +1373,7 @@ memory_displacement_operand (op, mode)
return
parts
.
disp
!=
NULL_RTX
;
}
/* To avoid problems when jump re-emits comparisons like testqi_ext_0,
/* To avoid problems when jump re-emits comparisons like testqi_ext_
ccno_
0,
re-recognize the operand to avoid a copy_to_mode_reg that will fail.
??? It seems likely that this will only work because cmpsi is an
...
...
@@ -4252,6 +4252,45 @@ ix86_unary_operator_ok (code, mode, operands)
return
TRUE
;
}
/* Return TRUE or FALSE depending on whether the first SET in INSN
has source and destination with matching CC modes, and that the
CC mode is at least as constrained as REQ_MODE. */
int
ix86_match_ccmode
(
insn
,
req_mode
)
rtx
insn
;
enum
machine_mode
req_mode
;
{
rtx
set
;
enum
machine_mode
set_mode
;
set
=
PATTERN
(
insn
);
if
(
GET_CODE
(
set
)
==
PARALLEL
)
set
=
XVECEXP
(
set
,
0
,
0
);
if
(
GET_CODE
(
set
)
!=
SET
)
abort
();
set_mode
=
GET_MODE
(
SET_DEST
(
set
));
switch
(
set_mode
)
{
case
CCmode
:
if
(
req_mode
==
CCNOmode
)
return
0
;
/* FALLTHRU */
case
CCNOmode
:
if
(
req_mode
==
CCZmode
)
return
0
;
/* FALLTHRU */
case
CCZmode
:
break
;
default
:
abort
();
}
return
(
GET_MODE
(
SET_SRC
(
set
))
==
set_mode
);
}
/* Produce an unsigned comparison for a given signed comparison. */
static
enum
rtx_code
...
...
@@ -4455,7 +4494,7 @@ ix86_expand_fp_compare (code, op0, op1, unordered)
abort
();
}
emit_insn
(
gen_testqi_ext_0
(
tmp
,
GEN_INT
(
mask
)));
emit_insn
(
gen_testqi_ext_
ccno_
0
(
tmp
,
GEN_INT
(
mask
)));
intcmp_mode
=
CCNOmode
;
}
}
...
...
@@ -4470,7 +4509,7 @@ ix86_expand_fp_compare (code, op0, op1, unordered)
switch
(
code
)
{
case
GT
:
emit_insn
(
gen_testqi_ext_0
(
tmp
,
GEN_INT
(
0x45
)));
emit_insn
(
gen_testqi_ext_
ccno_
0
(
tmp
,
GEN_INT
(
0x45
)));
code
=
EQ
;
break
;
case
LT
:
...
...
@@ -4480,7 +4519,7 @@ ix86_expand_fp_compare (code, op0, op1, unordered)
code
=
EQ
;
break
;
case
GE
:
emit_insn
(
gen_testqi_ext_0
(
tmp
,
GEN_INT
(
0x05
)));
emit_insn
(
gen_testqi_ext_
ccno_
0
(
tmp
,
GEN_INT
(
0x05
)));
code
=
EQ
;
break
;
case
LE
:
...
...
@@ -5490,7 +5529,8 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
rtx
align_4_label
=
gen_label_rtx
();
rtx
end_0_label
=
gen_label_rtx
();
rtx
mem
;
rtx
flags
=
gen_rtx_REG
(
CCNOmode
,
FLAGS_REG
);
rtx
no_flags
=
gen_rtx_REG
(
CCNOmode
,
FLAGS_REG
);
rtx
z_flags
=
gen_rtx_REG
(
CCNOmode
,
FLAGS_REG
);
rtx
tmpreg
=
gen_reg_rtx
(
SImode
);
align
=
0
;
...
...
@@ -5512,25 +5552,25 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
align_rtx
=
expand_binop
(
SImode
,
and_optab
,
scratch
,
GEN_INT
(
3
),
NULL_RTX
,
0
,
OPTAB_WIDEN
);
emit_insn
(
gen_cmpsi_
0
(
align_rtx
,
const0_rtx
));
emit_insn
(
gen_cmpsi_
ccz_1
(
align_rtx
,
const0_rtx
));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
z_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
align_4_label
),
pc_rtx
);
emit_jump_insn
(
gen_rtx_SET
(
VOIDmode
,
pc_rtx
,
tmp
));
emit_insn
(
gen_cmpsi_1
(
align_rtx
,
GEN_INT
(
2
)));
emit_insn
(
gen_cmpsi_
ccno_
1
(
align_rtx
,
GEN_INT
(
2
)));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
no_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
align_2_label
),
pc_rtx
);
emit_jump_insn
(
gen_rtx_SET
(
VOIDmode
,
pc_rtx
,
tmp
));
tmp
=
gen_rtx_GTU
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_GTU
(
VOIDmode
,
no_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
align_3_label
),
...
...
@@ -5545,9 +5585,9 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
align_rtx
=
expand_binop
(
SImode
,
and_optab
,
scratch
,
GEN_INT
(
2
),
NULL_RTX
,
0
,
OPTAB_WIDEN
);
emit_insn
(
gen_cmpsi_
0
(
align_rtx
,
const0_rtx
));
emit_insn
(
gen_cmpsi_
ccz_1
(
align_rtx
,
const0_rtx
));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
z_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
align_4_label
),
...
...
@@ -5560,9 +5600,9 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
/* Now compare the bytes. */
/* Compare the first n unaligned byte on a byte per byte basis. */
emit_insn
(
gen_cmpqi_
0
(
mem
,
const0_rtx
));
emit_insn
(
gen_cmpqi_
ccz_1
(
mem
,
const0_rtx
));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
z_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
end_0_label
),
pc_rtx
);
...
...
@@ -5576,9 +5616,9 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
{
emit_label
(
align_2_label
);
emit_insn
(
gen_cmpqi_
0
(
mem
,
const0_rtx
));
emit_insn
(
gen_cmpqi_
ccz_1
(
mem
,
const0_rtx
));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
z_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
end_0_label
),
...
...
@@ -5590,9 +5630,9 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
emit_label
(
align_3_label
);
}
emit_insn
(
gen_cmpqi_
0
(
mem
,
const0_rtx
));
emit_insn
(
gen_cmpqi_
ccz_1
(
mem
,
const0_rtx
));
tmp
=
gen_rtx_EQ
(
VOIDmode
,
flags
,
const0_rtx
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
z_
flags
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
gen_rtx_LABEL_REF
(
VOIDmode
,
end_0_label
),
pc_rtx
);
...
...
@@ -5626,7 +5666,7 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
emit_insn
(
gen_lshrsi3
(
reg
,
reg
,
GEN_INT
(
16
)));
/* If zero is not in the first two bytes, move two bytes forward. */
emit_insn
(
gen_testsi_1
(
tmpreg
,
GEN_INT
(
0x8080
)));
emit_insn
(
gen_testsi_
ccno_
1
(
tmpreg
,
GEN_INT
(
0x8080
)));
tmp
=
gen_rtx_REG
(
CCNOmode
,
FLAGS_REG
);
tmp
=
gen_rtx_EQ
(
VOIDmode
,
tmp
,
const0_rtx
);
emit_insn
(
gen_rtx_SET
(
VOIDmode
,
tmpreg
,
...
...
@@ -5650,7 +5690,7 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
rtx
end_2_label
=
gen_label_rtx
();
/* Is zero in the first two bytes? */
emit_insn
(
gen_testsi_1
(
tmpreg
,
GEN_INT
(
0x8080
)));
emit_insn
(
gen_testsi_
ccno_
1
(
tmpreg
,
GEN_INT
(
0x8080
)));
tmp
=
gen_rtx_REG
(
CCNOmode
,
FLAGS_REG
);
tmp
=
gen_rtx_NE
(
VOIDmode
,
tmp
,
const0_rtx
);
tmp
=
gen_rtx_IF_THEN_ELSE
(
VOIDmode
,
tmp
,
...
...
This diff is collapsed.
Click to expand it.
gcc/config/i386/i386.h
View file @
16189740
...
...
@@ -2160,10 +2160,13 @@ while (0)
Add CCNO to indicate No Overflow, which is often also includes
No Carry. This is typically used on the output of logicals,
and is only valid in comparisons against zero. */
and is only valid in comparisons against zero.
Add CCZ to indicate that only the Zero flag is valid. */
#define EXTRA_CC_MODES \
CC(CCNOmode, "CCNO") \
CC(CCZmode, "CCZ") \
CC(CCFPmode, "CCFP") \
CC(CCFPUmode, "CCFPU")
...
...
@@ -2173,7 +2176,7 @@ while (0)
For floating-point equality comparisons, CCFPEQmode should be used.
VOIDmode should be used in all other cases.
For integer comparisons against zero, reduce to CCNOmode if
For integer comparisons against zero, reduce to CCNOmode
or CCZmode
if
possible, to allow for more combinations. */
#define SELECT_CC_MODE(OP,X,Y) \
...
...
@@ -2181,7 +2184,7 @@ while (0)
? (OP) == EQ || (OP) == NE ? CCFPUmode : CCFPmode \
: (OP) == LE || (OP) == GT ? CCmode \
: (Y) != const0_rtx ? CCmode \
: CCNOmode)
:
(OP) == EQ || (OP) == NE ? CCZmode :
CCNOmode)
/* Control the assembler format that we output, to the extent
this does not vary between assemblers. */
...
...
This diff is collapsed.
Click to expand it.
gcc/config/i386/i386.md
View file @
16189740
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment