Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libtcg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton
libtcg
Commits
128c7d51
Commit
128c7d51
authored
1 year ago
by
Richard Henderson
Browse files
Options
Downloads
Patches
Plain Diff
tcg/s390x: Implement negsetcond_*
Signed-off-by:
Richard Henderson
<
richard.henderson@linaro.org
>
parent
41e4c0a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tcg/s390x/tcg-target.c.inc
+52
-26
52 additions, 26 deletions
tcg/s390x/tcg-target.c.inc
tcg/s390x/tcg-target.h
+2
-2
2 additions, 2 deletions
tcg/s390x/tcg-target.h
with
54 additions
and
28 deletions
tcg/s390x/tcg-target.c.inc
+
52
−
26
View file @
128c7d51
...
...
@@ -1266,7 +1266,8 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
}
static
void
tgen_setcond
(
TCGContext
*
s
,
TCGType
type
,
TCGCond
cond
,
TCGReg
dest
,
TCGReg
c1
,
TCGArg
c2
,
int
c2const
)
TCGReg
dest
,
TCGReg
c1
,
TCGArg
c2
,
bool
c2const
,
bool
neg
)
{
int
cc
;
...
...
@@ -1275,11 +1276,27 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
/* Emit: d = 0, d = (cc ? 1 : d). */
cc
=
tgen_cmp
(
s
,
type
,
cond
,
c1
,
c2
,
c2const
,
false
);
tcg_out_movi
(
s
,
TCG_TYPE_I64
,
dest
,
0
);
tcg_out_insn
(
s
,
RIEg
,
LOCGHI
,
dest
,
1
,
cc
);
tcg_out_insn
(
s
,
RIEg
,
LOCGHI
,
dest
,
neg
?
-
1
:
1
,
cc
);
return
;
}
restart
:
switch
(
cond
)
{
case
TCG_COND_GEU
:
case
TCG_COND_LTU
:
case
TCG_COND_LT
:
case
TCG_COND_GE
:
/* Swap operands so that we can use LEU/GTU/GT/LE. */
if
(
!
c2const
)
{
TCGReg
t
=
c1
;
c1
=
c2
;
c2
=
t
;
cond
=
tcg_swap_cond
(
cond
);
}
break
;
default
:
break
;
}
switch
(
cond
)
{
case
TCG_COND_NE
:
/* X != 0 is X > 0. */
...
...
@@ -1292,11 +1309,20 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
case
TCG_COND_GTU
:
case
TCG_COND_GT
:
/* The result of a compare has CC=2 for GT and CC=3 unused.
ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit. */
/*
* The result of a compare has CC=2 for GT and CC=3 unused.
* ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit.
*/
tgen_cmp
(
s
,
type
,
cond
,
c1
,
c2
,
c2const
,
true
);
tcg_out_movi
(
s
,
type
,
dest
,
0
);
tcg_out_insn
(
s
,
RRE
,
ALCGR
,
dest
,
dest
);
if
(
neg
)
{
if
(
type
==
TCG_TYPE_I32
)
{
tcg_out_insn
(
s
,
RR
,
LCR
,
dest
,
dest
);
}
else
{
tcg_out_insn
(
s
,
RRE
,
LCGR
,
dest
,
dest
);
}
}
return
;
case
TCG_COND_EQ
:
...
...
@@ -1310,27 +1336,17 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
case
TCG_COND_LEU
:
case
TCG_COND_LE
:
/* As above, but we're looking for borrow, or !carry.
The second insn computes d - d - borrow, or -1 for true
and 0 for false. So we must mask to 1 bit afterward. */
/*
* As above, but we're looking for borrow, or !carry.
* The second insn computes d - d - borrow, or -1 for true
* and 0 for false. So we must mask to 1 bit afterward.
*/
tgen_cmp
(
s
,
type
,
cond
,
c1
,
c2
,
c2const
,
true
);
tcg_out_insn
(
s
,
RRE
,
SLBGR
,
dest
,
dest
);
tgen_andi
(
s
,
type
,
dest
,
1
);
return
;
case
TCG_COND_GEU
:
case
TCG_COND_LTU
:
case
TCG_COND_LT
:
case
TCG_COND_GE
:
/* Swap operands so that we can use LEU/GTU/GT/LE. */
if
(
!
c2const
)
{
TCGReg
t
=
c1
;
c1
=
c2
;
c2
=
t
;
cond
=
tcg_swap_cond
(
cond
);
goto
restart
;
if
(
!
neg
)
{
tgen_andi
(
s
,
type
,
dest
,
1
);
}
b
re
ak
;
re
turn
;
default
:
g_assert_not_reached
();
...
...
@@ -1339,7 +1355,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
cc
=
tgen_cmp
(
s
,
type
,
cond
,
c1
,
c2
,
c2const
,
false
);
/* Emit: d = 0, t = 1, d = (cc ? t : d). */
tcg_out_movi
(
s
,
TCG_TYPE_I64
,
dest
,
0
);
tcg_out_movi
(
s
,
TCG_TYPE_I64
,
TCG_TMP0
,
1
);
tcg_out_movi
(
s
,
TCG_TYPE_I64
,
TCG_TMP0
,
neg
?
-
1
:
1
);
tcg_out_insn
(
s
,
RRFc
,
LOCGR
,
dest
,
TCG_TMP0
,
cc
);
}
...
...
@@ -2288,7 +2304,11 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
break
;
case
INDEX_op_setcond_i32
:
tgen_setcond
(
s
,
TCG_TYPE_I32
,
args
[
3
],
args
[
0
],
args
[
1
],
args
[
2
],
const_args
[
2
]);
args
[
2
],
const_args
[
2
],
false
);
break
;
case
INDEX_op_negsetcond_i32
:
tgen_setcond
(
s
,
TCG_TYPE_I32
,
args
[
3
],
args
[
0
],
args
[
1
],
args
[
2
],
const_args
[
2
],
true
);
break
;
case
INDEX_op_movcond_i32
:
tgen_movcond
(
s
,
TCG_TYPE_I32
,
args
[
5
],
args
[
0
],
args
[
1
],
...
...
@@ -2566,7 +2586,11 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
break
;
case
INDEX_op_setcond_i64
:
tgen_setcond
(
s
,
TCG_TYPE_I64
,
args
[
3
],
args
[
0
],
args
[
1
],
args
[
2
],
const_args
[
2
]);
args
[
2
],
const_args
[
2
],
false
);
break
;
case
INDEX_op_negsetcond_i64
:
tgen_setcond
(
s
,
TCG_TYPE_I64
,
args
[
3
],
args
[
0
],
args
[
1
],
args
[
2
],
const_args
[
2
],
true
);
break
;
case
INDEX_op_movcond_i64
:
tgen_movcond
(
s
,
TCG_TYPE_I64
,
args
[
5
],
args
[
0
],
args
[
1
],
...
...
@@ -3109,8 +3133,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
case
INDEX_op_rotr_i32
:
case
INDEX_op_rotr_i64
:
case
INDEX_op_setcond_i32
:
case
INDEX_op_negsetcond_i32
:
return
C_O1_I2
(
r
,
r
,
ri
);
case
INDEX_op_setcond_i64
:
case
INDEX_op_negsetcond_i64
:
return
C_O1_I2
(
r
,
r
,
rA
);
case
INDEX_op_clz_i64
:
...
...
This diff is collapsed.
Click to expand it.
tcg/s390x/tcg-target.h
+
2
−
2
View file @
128c7d51
...
...
@@ -96,7 +96,7 @@ extern uint64_t s390_facilities[3];
#define TCG_TARGET_HAS_sextract_i32 0
#define TCG_TARGET_HAS_extract2_i32 0
#define TCG_TARGET_HAS_movcond_i32 1
#define TCG_TARGET_HAS_negsetcond_i32
0
#define TCG_TARGET_HAS_negsetcond_i32
1
#define TCG_TARGET_HAS_add2_i32 1
#define TCG_TARGET_HAS_sub2_i32 1
#define TCG_TARGET_HAS_mulu2_i32 0
...
...
@@ -132,7 +132,7 @@ extern uint64_t s390_facilities[3];
#define TCG_TARGET_HAS_sextract_i64 0
#define TCG_TARGET_HAS_extract2_i64 0
#define TCG_TARGET_HAS_movcond_i64 1
#define TCG_TARGET_HAS_negsetcond_i64
0
#define TCG_TARGET_HAS_negsetcond_i64
1
#define TCG_TARGET_HAS_add2_i64 1
#define TCG_TARGET_HAS_sub2_i64 1
#define TCG_TARGET_HAS_mulu2_i64 1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment