mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
Add test for PC-style labels.
These are labels which are given a numeric value. For example, the following code would generate PC labels 0 to 4: for (int i = 0; i < 5; i++) { |=>i: }
This commit is contained in:
parent
cdfb632a4f
commit
155577093a
@ -202,6 +202,23 @@ static void save(dasm_State *state)
|
|||||||
| br r14
|
| br r14
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pc(dasm_State *state) {
|
||||||
|
dasm_State **Dst = &state;
|
||||||
|
int MAX = 10;
|
||||||
|
dasm_growpc(Dst, MAX+1);
|
||||||
|
|
||||||
|
| j =>MAX
|
||||||
|
for (int i = 0; i <= MAX; i++) {
|
||||||
|
|=>i:
|
||||||
|
if (i == 0) {
|
||||||
|
| br r14
|
||||||
|
} else {
|
||||||
|
| aghi r2, i
|
||||||
|
| j =>i-1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t arg1;
|
int64_t arg1;
|
||||||
int64_t arg2;
|
int64_t arg2;
|
||||||
@ -222,7 +239,8 @@ test_table test[] = {
|
|||||||
{ 2, 0, add_imm32, 16, "imm32"},
|
{ 2, 0, add_imm32, 16, "imm32"},
|
||||||
{ 7, 3, save, 480, "save"},
|
{ 7, 3, save, 480, "save"},
|
||||||
{ 7, 3, labmul, 21, "labmul0"},
|
{ 7, 3, labmul, 21, "labmul0"},
|
||||||
{ 7, 0, labmul, 0, "labmul1"}
|
{ 7, 0, labmul, 0, "labmul1"},
|
||||||
|
{ 0, 0, pc, 55, "pc"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *jitcode(dasm_State **state, size_t *size)
|
static void *jitcode(dasm_State **state, size_t *size)
|
||||||
|
Loading…
Reference in New Issue
Block a user