Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
49abde26
Commit
49abde26
authored
Mar 31, 2014
by
Christoph Mallon
Browse files
ia32: Add and use ia32_is_8bit_val().
parent
9cd833e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/bearch_ia32_t.h
View file @
49abde26
...
...
@@ -129,4 +129,9 @@ void ia32_adjust_pic(ir_graph *irg);
ir_node
*
ia32_get_pic_base
(
ir_graph
*
irg
);
static
inline
bool
ia32_is_8bit_val
(
int32_t
const
v
)
{
return
-
128
<=
v
&&
v
<
128
;
}
#endif
ir/be/ia32/ia32_common_transform.c
View file @
49abde26
...
...
@@ -37,13 +37,13 @@ static bool check_immediate_constraint(long val, char immediate_constraint_type)
case
'i'
:
case
'n'
:
return
true
;
case
'I'
:
return
0
<=
val
&&
val
<=
31
;
case
'J'
:
return
0
<=
val
&&
val
<=
63
;
case
'K'
:
return
-
128
<=
val
&&
val
<=
127
;
case
'I'
:
return
0
<=
val
&&
val
<=
31
;
case
'J'
:
return
0
<=
val
&&
val
<=
63
;
case
'K'
:
return
ia32_is_8bit_val
(
val
)
;
case
'L'
:
return
val
==
0xff
||
val
==
0xffff
;
case
'M'
:
return
0
<=
val
&&
val
<=
3
;
case
'N'
:
return
0
<=
val
&&
val
<=
255
;
case
'O'
:
return
0
<=
val
&&
val
<=
127
;
case
'M'
:
return
0
<=
val
&&
val
<=
3
;
case
'N'
:
return
0
<=
val
&&
val
<=
255
;
case
'O'
:
return
0
<=
val
&&
val
<=
127
;
default:
panic
(
"Invalid immediate constraint found"
);
}
...
...
ir/be/ia32/ia32_emitter.c
View file @
49abde26
...
...
@@ -1920,7 +1920,7 @@ static void bemit_modrm8(reg_modifier_t high_part, const arch_register_t *reg)
*/
static
unsigned
get_signed_imm_size
(
int
offset
)
{
if
(
-
128
<=
offset
&&
offset
<
128
)
{
if
(
ia32_is_8bit_val
(
offset
)
)
{
return
1
;
}
else
if
(
-
32768
<=
offset
&&
offset
<
32768
)
{
return
2
;
...
...
@@ -1956,7 +1956,7 @@ static void bemit_mod_am(unsigned reg, const ir_node *node)
}
else
if
(
offs
==
0
)
{
modrm
|=
MOD_IND
;
emitoffs
=
0
;
}
else
if
(
-
128
<=
offs
&&
offs
<
128
)
{
}
else
if
(
ia32_is_8bit_val
(
offs
)
)
{
modrm
|=
MOD_IND_BYTE_OFS
;
emitoffs
=
8
;
}
else
{
...
...
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