X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flightning%2Fcheck%2Flightning.c;h=80ea0816632876432f7798114e23cd0de711aef7;hb=02a5662c31c401081716623cc80bb1c4ab1dbb19;hp=e60ef05d697f9d51f10b8135f32a8b288dcba6b2;hpb=3918505613cb814f8f5e0e8e0471f7b2a2cd8464;p=pcsx_rearmed.git diff --git a/deps/lightning/check/lightning.c b/deps/lightning/check/lightning.c index e60ef05d..80ea0816 100644 --- a/deps/lightning/check/lightning.c +++ b/deps/lightning/check/lightning.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2019 Free Software Foundation, Inc. + * Copyright (C) 2012-2022 Free Software Foundation, Inc. * * This file is part of GNU lightning. * @@ -30,6 +30,7 @@ #include #include #include +#include #if defined(__linux__) && (defined(__i386__) || defined(__x86_64__)) # include @@ -269,10 +270,16 @@ static jit_pointer_t get_arg(void); static jit_word_t get_imm(void); static void live(void); static void align(void); static void name(void); +static void skip(void); static void prolog(void); static void frame(void); static void tramp(void); static void ellipsis(void); static void allocai(void); static void allocar(void); +static void arg_c(void); static void arg_s(void); +static void arg_i(void); +#if __WORDSIZE == 64 +static void arg_l(void); +#endif static void arg(void); static void getarg_c(void); static void getarg_uc(void); static void getarg_s(void); static void getarg_us(void); @@ -281,6 +288,15 @@ static void getarg_i(void); static void getarg_ui(void); static void getarg_l(void); #endif static void getarg(void); +static void putargr_c(void); static void putargi_c(void); +static void putargr_uc(void); static void putargi_uc(void); +static void putargr_s(void); static void putargi_s(void); +static void putargr_us(void); static void putargi_us(void); +static void putargr_i(void); static void putargi_i(void); +#if __WORDSIZE == 64 +static void putargr_ui(void); static void putargi_ui(void); +static void putargr_l(void); static void putargi_l(void); +#endif static void putargr(void); static void putargi(void); static void addr(void); static void addi(void); static void addxr(void); static void addxi(void); @@ -305,6 +321,8 @@ static void lshr(void); static void lshi(void); static void rshr(void); static void rshi(void); static void rshr_u(void); static void rshi_u(void); static void negr(void); static void comr(void); +static void clor(void); static void clzr(void); +static void ctor(void); static void ctzr(void); static void ltr(void); static void lti(void); static void ltr_u(void); static void lti_u(void); static void ler(void); static void lei(void); @@ -315,6 +333,7 @@ static void ger_u(void); static void gei_u(void); static void gtr(void); static void gti(void); static void gtr_u(void); static void gti_u(void); static void ner(void); static void nei(void); +static void casr(void); static void casi(void); static void movr(void); static void movi(void); static void extr_c(void); static void extr_uc(void); static void extr_s(void); static void extr_us(void); @@ -327,6 +346,12 @@ static void htonr_ui(void); static void ntohr_ui(void); static void htonr_ul(void); static void ntohr_ul(void); #endif static void htonr(void); static void ntohr(void); +static void bswapr_us(void); static void bswapr_ui(void); +#if __WORDSIZE == 64 +static void bswapr_ul(void); +#endif +static void bswapr(void); +static void movnr(void); static void movzr(void); static void ldr_c(void); static void ldi_c(void); static void ldr_uc(void); static void ldi_uc(void); static void ldr_s(void); static void ldi_s(void); @@ -384,9 +409,30 @@ static void bxsubr_u(void); static void bxsubi_u(void); static void jmpr(void); static void jmpi(void); static void callr(void); static void calli(void); static void prepare(void); + +static void pushargr_c(void); static void pushargi_c(void); +static void pushargr_uc(void); static void pushargi_uc(void); +static void pushargr_s(void); static void pushargi_s(void); +static void pushargr_us(void); static void pushargi_us(void); +static void pushargr_i(void); static void pushargi_i(void); +#if __WORDSIZE == 64 +static void pushargr_ui(void); static void pushargi_ui(void); +static void pushargr_l(void); static void pushargi_l(void); +#endif static void pushargr(void); static void pushargi(void); + static void finishr(void); static void finishi(void); static void ret(void); + +static void retr_c(void); static void reti_c(void); +static void retr_uc(void); static void reti_uc(void); +static void retr_s(void); static void reti_s(void); +static void retr_us(void); static void reti_us(void); +static void retr_i(void); static void reti_i(void); +#if __WORDSIZE == 64 +static void retr_ui(void); static void reti_ui(void); +static void retr_l(void); static void reti_l(void); +#endif static void retr(void); static void reti(void); static void retval_c(void); static void retval_uc(void); static void retval_s(void); static void retval_us(void); @@ -583,10 +629,16 @@ static instr_t instr_vector[] = { #define entry2(name, function) { NULL, name, function } entry(live), entry(align), entry(name), + entry(skip), entry(prolog), entry(frame), entry(tramp), entry(ellipsis), entry(allocai), entry(allocar), + entry(arg_c), entry(arg_s), + entry(arg_i), +#if __WORDSIZE == 64 + entry(arg_l), +#endif entry(arg), entry(getarg_c), entry(getarg_uc), entry(getarg_s), entry(getarg_us), @@ -595,6 +647,16 @@ static instr_t instr_vector[] = { entry(getarg_ui), entry(getarg_l), #endif entry(getarg), + + entry(putargr_c), entry(putargi_c), + entry(putargr_uc), entry(putargi_uc), + entry(putargr_s), entry(putargi_s), + entry(putargr_us), entry(putargi_us), + entry(putargr_i), entry(putargi_i), +#if __WORDSIZE == 64 + entry(putargr_ui), entry(putargi_ui), + entry(putargr_l), entry(putargi_l), +#endif entry(putargr), entry(putargi), entry(addr), entry(addi), entry(addxr), entry(addxi), @@ -619,6 +681,8 @@ static instr_t instr_vector[] = { entry(rshr), entry(rshi), entry(rshr_u), entry(rshi_u), entry(negr), entry(comr), + entry(clor), entry(clzr), + entry(ctor), entry(ctzr), entry(ltr), entry(lti), entry(ltr_u), entry(lti_u), entry(ler), entry(lei), @@ -629,6 +693,7 @@ static instr_t instr_vector[] = { entry(gtr), entry(gti), entry(gtr_u), entry(gti_u), entry(ner), entry(nei), + entry(casr), entry(casi), entry(movr), entry(movi), entry(extr_c), entry(extr_uc), entry(extr_s), entry(extr_us), @@ -641,6 +706,12 @@ static instr_t instr_vector[] = { entry(htonr_ul), entry(ntohr_ul), #endif entry(htonr), entry(ntohr), + entry(bswapr_us), entry(bswapr_ui), +#if __WORDSIZE == 64 + entry(bswapr_ul), +#endif + entry(bswapr), + entry(movnr), entry(movzr), entry(ldr_c), entry(ldi_c), entry(ldr_uc), entry(ldi_uc), entry(ldr_s), entry(ldi_s), @@ -698,9 +769,27 @@ static instr_t instr_vector[] = { entry(jmpr), entry(jmpi), entry(callr), entry(calli), entry(prepare), + entry(pushargr_c), entry(pushargi_c), + entry(pushargr_uc), entry(pushargi_uc), + entry(pushargr_s), entry(pushargi_s), + entry(pushargr_us), entry(pushargi_us), + entry(pushargr_i), entry(pushargi_i), +#if __WORDSIZE == 64 + entry(pushargr_ui), entry(pushargi_ui), + entry(pushargr_l), entry(pushargi_l), +#endif entry(pushargr), entry(pushargi), entry(finishr), entry(finishi), entry(ret), + entry(retr_c), entry(reti_c), + entry(retr_uc), entry(reti_uc), + entry(retr_s), entry(reti_s), + entry(retr_us), entry(reti_us), + entry(retr_i), entry(reti_i), +#if __WORDSIZE == 64 + entry(retr_ui), entry(reti_ui), + entry(retr_l), entry(reti_l), +#endif entry(retr), entry(reti), entry(retval_c), entry(retval_uc), entry(retval_s), entry(retval_us), @@ -1015,6 +1104,16 @@ name(void) \ jit_word_t im = get_imm(); \ jit_##name(r0, r1, r2, im); \ } +#define entry_ir_im_ir_ir(name) \ +static void \ +name(void) \ +{ \ + jit_gpr_t r0 = get_ireg(); \ + jit_word_t im = get_imm(); \ + jit_gpr_t r1 = get_ireg(), r2 = get_ireg(); \ + jit_##name(r0, im, r1, r2); \ +} + #define entry_ir_ir(name) \ static void \ name(void) \ @@ -1375,6 +1474,7 @@ live(void) { jit_live(parser.regval); } entry_im(align) +entry_im(skip) entry(prolog) entry_im(frame) entry_im(tramp) entry(ellipsis) @@ -1388,6 +1488,11 @@ allocai(void) { symbol->value.i = i; } entry_ir_ir(allocar) +entry_ca(arg_c) entry_ca(arg_s) +entry_ca(arg_i) +#if __WORDSIZE == 64 +entry_ca(arg_l) +#endif entry_ca(arg) entry_ia(getarg_c) entry_ia(getarg_uc) entry_ia(getarg_s) entry_ia(getarg_us) @@ -1396,6 +1501,15 @@ entry_ia(getarg_i) entry_ia(getarg_ui) entry_ia(getarg_l) #endif entry_ia(getarg) +entry_ia(putargr_c) entry_ima(putargi_c) +entry_ia(putargr_uc) entry_ima(putargi_uc) +entry_ia(putargr_s) entry_ima(putargi_s) +entry_ia(putargr_us) entry_ima(putargi_us) +entry_ia(putargr_i) entry_ima(putargi_i) +#if __WORDSIZE == 64 +entry_ia(putargr_ui) entry_ima(putargi_ui) +entry_ia(putargr_l) entry_ima(putargi_l) +#endif entry_ia(putargr) entry_ima(putargi) entry_ir_ir_ir(addr) entry_ir_ir_im(addi) entry_ir_ir_ir(addxr) entry_ir_ir_im(addxi) @@ -1420,6 +1534,8 @@ entry_ir_ir_ir(lshr) entry_ir_ir_im(lshi) entry_ir_ir_ir(rshr) entry_ir_ir_im(rshi) entry_ir_ir_ir(rshr_u) entry_ir_ir_im(rshi_u) entry_ir_ir(negr) entry_ir_ir(comr) +entry_ir_ir(clor) entry_ir_ir(clzr) +entry_ir_ir(ctor) entry_ir_ir(ctzr) entry_ir_ir_ir(ltr) entry_ir_ir_im(lti) entry_ir_ir_ir(ltr_u) entry_ir_ir_im(lti_u) entry_ir_ir_ir(ler) entry_ir_ir_im(lei) @@ -1430,6 +1546,7 @@ entry_ir_ir_ir(ger_u) entry_ir_ir_im(gei_u) entry_ir_ir_ir(gtr) entry_ir_ir_im(gti) entry_ir_ir_ir(gtr_u) entry_ir_ir_im(gti_u) entry_ir_ir_ir(ner) entry_ir_ir_im(nei) +entry_ir_ir_ir_ir(casr) entry_ir_im_ir_ir(casi) entry_ir_ir(movr) static void movi(void) @@ -1489,6 +1606,12 @@ entry_ir_ir(htonr_ui) entry_ir_ir(ntohr_ui) entry_ir_ir(htonr_ul) entry_ir_ir(ntohr_ul) #endif entry_ir_ir(htonr) entry_ir_ir(ntohr) +entry_ir_ir(bswapr_us) entry_ir_ir(bswapr_ui) +#if __WORDSIZE == 64 +entry_ir_ir(bswapr_ul) +#endif +entry_ir_ir(bswapr) +entry_ir_ir_ir(movnr) entry_ir_ir_ir(movzr) entry_ir_ir(ldr_c) entry_ir_pm(ldi_c) entry_ir_ir(ldr_uc) entry_ir_pm(ldi_uc) entry_ir_ir(ldr_s) entry_ir_pm(ldi_s) @@ -1546,9 +1669,27 @@ entry_lb_ir_ir(bxsubr_u) entry_lb_ir_im(bxsubi_u) entry_ir(jmpr) entry_lb(jmpi) entry_ir(callr) entry_fn(calli) entry(prepare) +entry_ir(pushargr_c) entry_im(pushargi_c) +entry_ir(pushargr_uc) entry_im(pushargi_uc) +entry_ir(pushargr_s) entry_im(pushargi_s) +entry_ir(pushargr_us) entry_im(pushargi_us) +entry_ir(pushargr_i) entry_im(pushargi_i) +#if __WORDSIZE == 64 +entry_ir(pushargr_ui) entry_im(pushargi_ui) +entry_ir(pushargr_l) entry_im(pushargi_l) +#endif entry_ir(pushargr) entry_im(pushargi) entry_ir(finishr) entry_fn(finishi) entry(ret) +entry_ir(retr_c) entry_im(reti_c) +entry_ir(retr_uc) entry_im(reti_uc) +entry_ir(retr_s) entry_im(reti_s) +entry_ir(retr_us) entry_im(reti_us) +entry_ir(retr_i) entry_im(reti_i) +#if __WORDSIZE == 64 +entry_ir(retr_ui) entry_im(reti_ui) +entry_ir(retr_l) entry_im(reti_l) +#endif entry_ir(retr) entry_im(reti) entry_ir(retval_c) entry_ir(retval_uc) entry_ir(retval_s) entry_ir(retval_us) @@ -3791,11 +3932,16 @@ execute(int argc, char *argv[]) function = jit_emit(); if (flag_verbose > 1 || flag_disasm) { jit_print(); - fprintf(stdout, " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); + fprintf(stderr, " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); } if (flag_verbose > 0 || flag_disasm) { jit_disassemble(); - fprintf(stdout, " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); + fprintf(stderr, " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); + } + if (flag_verbose && argc) { + for (result = 0; result < argc; result++) + printf("argv[%d] = %s\n", result, argv[result]); + fprintf(stderr, " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); } jit_clear_state(); @@ -3996,12 +4142,11 @@ usage(void) { #if HAVE_GETOPT_LONG_ONLY fprintf(stderr, "\ -Usage: %s [jit assembler options] file [jit program options]\n\ +Usage: %s [jit assembler options] file [--] [jit program options]\n\ Jit assembler options:\n\ -help Display this information\n\ -v[0-3] Verbose output level\n\ - -d Do not use a data buffer\n\ - -D[=] Preprocessor options\n" + -d Do not use a data buffer\n" # if defined(__i386__) && __WORDSIZE == 32 " -mx87=1 Force using x87 when sse2 available\n" # endif @@ -4017,11 +4162,10 @@ Jit assembler options:\n\ , progname); #else fprintf(stderr, "\ -Usage: %s [jit assembler options] file [jit program options]\n\ +Usage: %s [jit assembler options] file [--] [jit program options]\n\ Jit assembler options:\n\ -h Display this information\n\ - -v Verbose output level\n\ - -D[=] Preprocessor options\n", progname); + -v Verbose output level\n", progname); #endif finish_jit(); exit(1); @@ -4196,16 +4340,6 @@ main(int argc, char *argv[]) # define cc "gcc" #endif opt_short = snprintf(cmdline, sizeof(cmdline), cc " -E -x c %s", argv[opt_index]); - for (++opt_index; opt_index < argc; opt_index++) { - if (argv[opt_index][0] == '-') - opt_short += snprintf(cmdline + opt_short, - sizeof(cmdline) - opt_short, - " %s", argv[opt_index]); - else { - --opt_index; - break; - } - } opt_short += snprintf(cmdline + opt_short, sizeof(cmdline) - opt_short, " -D__WORDSIZE=%d", __WORDSIZE); @@ -4232,6 +4366,9 @@ main(int argc, char *argv[]) opt_short += snprintf(cmdline + opt_short, sizeof(cmdline) - opt_short, " -D__mips__=1"); + opt_short += snprintf(cmdline + opt_short, + sizeof(cmdline) - opt_short, + " -D__mips_isa_rev=%d", jit_cpu.release); #endif #if defined(__arm__) opt_short += snprintf(cmdline + opt_short, @@ -4282,6 +4419,11 @@ main(int argc, char *argv[]) opt_short += snprintf(cmdline + opt_short, sizeof(cmdline) - opt_short, " -D__alpha__=1"); +#endif +#if defined(__loongarch__) + opt_short += snprintf(cmdline + opt_short, + sizeof(cmdline) - opt_short, + " -D__loongarch__=1"); #endif if ((parser.fp = popen(cmdline, "r")) == NULL) error("cannot execute %s", cmdline);