Unified · Split
| @@ -398,6 +398,15 @@ static void asm_unary_opcode(TCCState *s1, int token) · 397 unmodified lines | |||
| 398 | case TOK_ASM_rdinstreth: | 398 | case TOK_ASM_rdinstreth: |
| 399 | asm_emit_opcode(opcode | (0xC82 << 20) | ENCODE_RD(op.reg)); | 399 | asm_emit_opcode(opcode | (0xC82 << 20) | ENCODE_RD(op.reg)); |
| 400 | return; | 400 | return; |
| 401 | case TOK_ASM_frflags: | ||
| 402 | asm_emit_opcode(opcode | (0x001 << 20) | ENCODE_RD(op.reg)); | ||
| 403 | return; | ||
| 404 | case TOK_ASM_frrm: | ||
| 405 | asm_emit_opcode(opcode | (0x002 << 20) | ENCODE_RD(op.reg)); | ||
| 406 | return; | ||
| 407 | case TOK_ASM_frcsr: | ||
| 408 | asm_emit_opcode(opcode | (0x003 << 20) | ENCODE_RD(op.reg)); | ||
| 409 | return; | ||
| 401 | 410 | ||
| 402 | case TOK_ASM_jr: | 411 | case TOK_ASM_jr: |
| 403 | /* jalr zero, 0(rs)*/ | 412 | /* jalr zero, 0(rs)*/ |
| @@ -431,6 +440,7 @@ static void asm_unary_opcode(TCCState *s1, int token) · 27 unmodified lines | |||
| 431 | case TOK_ASM_c_jr: | 440 | case TOK_ASM_c_jr: |
| 432 | asm_emit_cr(token, 2 | (8 << 12), &op, &zero); | 441 | asm_emit_cr(token, 2 | (8 << 12), &op, &zero); |
| 433 | return; | 442 | return; |
| 443 | |||
| 434 | default: | 444 | default: |
| 435 | expect("unary instruction"); | 445 | expect("unary instruction"); |
| 436 | } | 446 | } |
| @@ -702,6 +712,22 @@ static void asm_binary_opcode(TCCState* s1, int token) · 265 unmodified lines | |||
| 702 | asm_emit_f(token, 0x53 | (4 << 27) | (0 << 25) | (2 << 12), &ops[0], &ops[1], &ops[1]); | 712 | asm_emit_f(token, 0x53 | (4 << 27) | (0 << 25) | (2 << 12), &ops[0], &ops[1], &ops[1]); |
| 703 | return; | 713 | return; |
| 704 | 714 | ||
| 715 | case TOK_ASM_csrs: | ||
| 716 | /* csrrs x0, csr, rs */ | ||
| 717 | asm_emit_opcode(0x73 | (2 << 12) | (ops[0].e.v << 20) | ENCODE_RS1(ops[1].reg)); | ||
| 718 | return; | ||
| 719 | case TOK_ASM_csrc: | ||
| 720 | /* csrrc x0, csr, rs */ | ||
| 721 | asm_emit_opcode(0x73 | (3 << 12) | (ops[0].e.v << 20) | ENCODE_RS1(ops[1].reg)); | ||
| 722 | return; | ||
| 723 | case TOK_ASM_fsrm: | ||
| 724 | /* csrrw rd, frm, rs */ | ||
| 725 | asm_emit_opcode(0x73 | (1 << 12) | (2 << 20) | ENCODE_RD(ops[0].reg) | ENCODE_RS1(ops[1].reg)); | ||
| 726 | return; | ||
| 727 | case TOK_ASM_fscsr: | ||
| 728 | /* csrrw rd, fcsr, rs */ | ||
| 729 | asm_emit_opcode(0x73 | (1 << 12) | (3 << 20) | ENCODE_RD(ops[0].reg) | ENCODE_RS1(ops[1].reg)); | ||
| 730 | return; | ||
| 705 | default: | 731 | default: |
| 706 | expect("binary instruction"); | 732 | expect("binary instruction"); |
| 707 | } | 733 | } |
| @@ -1564,6 +1590,9 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 856 unmodified lines | |||
| 1564 | case TOK_ASM_jr: | 1590 | case TOK_ASM_jr: |
| 1565 | case TOK_ASM_call: | 1591 | case TOK_ASM_call: |
| 1566 | case TOK_ASM_tail: | 1592 | case TOK_ASM_tail: |
| 1593 | case TOK_ASM_frflags: | ||
| 1594 | case TOK_ASM_frrm: | ||
| 1595 | case TOK_ASM_frcsr: | ||
| 1567 | asm_unary_opcode(s1, token); | 1596 | asm_unary_opcode(s1, token); |
| 1568 | return; | 1597 | return; |
| 1569 | 1598 | ||
| @@ -1581,6 +1610,10 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 11 unmodified lines | |||
| 1581 | case TOK_ASM_negw: | 1610 | case TOK_ASM_negw: |
| 1582 | case TOK_ASM_fabs_s: | 1611 | case TOK_ASM_fabs_s: |
| 1583 | case TOK_ASM_fabs_d: | 1612 | case TOK_ASM_fabs_d: |
| 1613 | case TOK_ASM_csrc: | ||
| 1614 | case TOK_ASM_csrs: | ||
| 1615 | case TOK_ASM_fsrm: | ||
| 1616 | case TOK_ASM_fscsr: | ||
| 1584 | asm_binary_opcode(s1, token); | 1617 | asm_binary_opcode(s1, token); |
| 1585 | return; | 1618 | return; |
| 1586 | 1619 | ||