'p' is conservatively the same as 'r' and 'P' as template modifier can be ignored in TCC.
Unified · Split
| @@ -1002,6 +1002,7 @@ static inline int constraint_priority(const char *str) · 1001 unmodified lines | ||
| 1002 | 1002 | pr = 2; |
| 1003 | 1003 | break; |
| 1004 | 1004 | case 'r': |
| 1005 | + case 'p': | |
| 1005 | 1006 | pr = 3; |
| 1006 | 1007 | break; |
| 1007 | 1008 | case 'N': |
| @@ -1170,6 +1171,7 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands, · 162 unmodified lines | ||
| 1170 | 1171 | } |
| 1171 | 1172 | goto try_next; |
| 1172 | 1173 | case 'r': |
| 1174 | + case 'p': /* A general address, for x86(64) any register is acceptable*/ | |
| 1173 | 1175 | /* any general register */ |
| 1174 | 1176 | for(reg = 0; reg < 8; reg++) { |
| 1175 | 1177 | if (!is_reg_allocated(reg)) |
| @@ -991,7 +991,10 @@ static void subst_asm_operands(ASMOperand *operands, int nb_operands, · 990 unmodified lines | ||
| 991 | 991 | modifier = 0; |
| 992 | 992 | if (*str == 'c' || *str == 'n' || |
| 993 | 993 | *str == 'b' || *str == 'w' || |
| 994 | − *str == 'h' || *str == 'k' || *str == 'q') | |
| 994 | + *str == 'h' || *str == 'k' || *str == 'q' || | |
| 995 | + /* P in GCC would add "@PLT" to symbol refs in PIC mode | |
| 996 | + Ignore this in TCC. */ | |
| 997 | + *str == 'P') | |
| 995 | 998 | modifier = *str++; |
| 996 | 999 | index = find_constraint(operands, nb_operands, str, &str); |
| 997 | 1000 | if (index < 0) |
| @@ -2600,6 +2600,14 @@ int fls64(unsigned long long x) · 2599 unmodified lines | ||
| 2600 | 2600 | } |
| 2601 | 2601 | #endif |
| 2602 | 2602 | |
| 2603 | +void other_constraints_test(void) | |
| 2604 | +{ | |
| 2605 | + unsigned long ret; | |
| 2606 | + int var; | |
| 2607 | + __asm__ volatile ("movq %P1,%0" : "=r" (ret) : "p" (&var)); | |
| 2608 | + printf ("oc1: %d\n", ret == (unsigned long)&var); | |
| 2609 | +} | |
| 2610 | + | |
| 2603 | 2611 | unsigned int set; |
| 2604 | 2612 | |
| 2605 | 2613 | void asm_test(void) |
| @@ -2633,6 +2641,7 @@ void asm_test(void) · 27 unmodified lines | ||
| 2633 | 2641 | s1.b = 43; |
| 2634 | 2642 | printf("mconstraint: %d", mconstraint_test(&s2)); |
| 2635 | 2643 | printf(" %d %d\n", s1.a, s1.b); |
| 2644 | + other_constraints_test(); | |
| 2636 | 2645 | set = 0xff; |
| 2637 | 2646 | sigdelset1(&set, 2); |
| 2638 | 2647 | sigaddset1(&set, 16); |