forked from Mirrors/tinycc
inline asm: Accept 'p' constraint and 'P' template mod
'p' is conservatively the same as 'r' and 'P' as template modifier can be ignored in TCC.master
parent
63e3ff7cca
commit
253afeed1e
|
@ -1002,6 +1002,7 @@ static inline int constraint_priority(const char *str)
|
||||||
pr = 2;
|
pr = 2;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
case 'p':
|
||||||
pr = 3;
|
pr = 3;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
|
@ -1170,6 +1171,7 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands,
|
||||||
}
|
}
|
||||||
goto try_next;
|
goto try_next;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
case 'p': /* A general address, for x86(64) any register is acceptable*/
|
||||||
/* any general register */
|
/* any general register */
|
||||||
for(reg = 0; reg < 8; reg++) {
|
for(reg = 0; reg < 8; reg++) {
|
||||||
if (!is_reg_allocated(reg))
|
if (!is_reg_allocated(reg))
|
||||||
|
|
5
tccasm.c
5
tccasm.c
|
@ -991,7 +991,10 @@ static void subst_asm_operands(ASMOperand *operands, int nb_operands,
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
if (*str == 'c' || *str == 'n' ||
|
if (*str == 'c' || *str == 'n' ||
|
||||||
*str == 'b' || *str == 'w' ||
|
*str == 'b' || *str == 'w' ||
|
||||||
*str == 'h' || *str == 'k' || *str == 'q')
|
*str == 'h' || *str == 'k' || *str == 'q' ||
|
||||||
|
/* P in GCC would add "@PLT" to symbol refs in PIC mode
|
||||||
|
Ignore this in TCC. */
|
||||||
|
*str == 'P')
|
||||||
modifier = *str++;
|
modifier = *str++;
|
||||||
index = find_constraint(operands, nb_operands, str, &str);
|
index = find_constraint(operands, nb_operands, str, &str);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
|
|
@ -2600,6 +2600,14 @@ int fls64(unsigned long long x)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void other_constraints_test(void)
|
||||||
|
{
|
||||||
|
unsigned long ret;
|
||||||
|
int var;
|
||||||
|
__asm__ volatile ("movq %P1,%0" : "=r" (ret) : "p" (&var));
|
||||||
|
printf ("oc1: %d\n", ret == (unsigned long)&var);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int set;
|
unsigned int set;
|
||||||
|
|
||||||
void asm_test(void)
|
void asm_test(void)
|
||||||
|
@ -2633,6 +2641,7 @@ void asm_test(void)
|
||||||
s1.b = 43;
|
s1.b = 43;
|
||||||
printf("mconstraint: %d", mconstraint_test(&s2));
|
printf("mconstraint: %d", mconstraint_test(&s2));
|
||||||
printf(" %d %d\n", s1.a, s1.b);
|
printf(" %d %d\n", s1.a, s1.b);
|
||||||
|
other_constraints_test();
|
||||||
set = 0xff;
|
set = 0xff;
|
||||||
sigdelset1(&set, 2);
|
sigdelset1(&set, 2);
|
||||||
sigaddset1(&set, 16);
|
sigaddset1(&set, 16);
|
||||||
|
|
Loading…
Reference in New Issue