diff options
-rw-r--r-- | cgcalc.c | 10 | ||||
-rw-r--r-- | cgcode.c | 8 | ||||
-rw-r--r-- | cgcodep.h | 4 | ||||
-rw-r--r-- | cgconst.h | 5 | ||||
-rw-r--r-- | cgiconst.h | 4 | ||||
-rw-r--r-- | cginput.c | 4 | ||||
-rw-r--r-- | cglin.c | 6 | ||||
-rw-r--r-- | cgopt.c | 6 | ||||
-rw-r--r-- | cgpas.c | 31 | ||||
-rw-r--r-- | cgpwas.c | 24 |
10 files changed, 80 insertions, 22 deletions
@@ -2307,7 +2307,7 @@ void calculate_graph_register_uses (INSTRUCTION_GRAPH graph) calculate_eor_operator (graph); return; case GCNOT: -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GNEG: case GNOT: #endif @@ -2342,7 +2342,7 @@ void calculate_graph_register_uses (INSTRUCTION_GRAPH graph) case GFEXP: case GFSQRT: case GFNEG: -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GFABS: #endif calculate_monadic_float_operator (graph); @@ -2538,7 +2538,7 @@ void count_graph (INSTRUCTION_GRAPH graph) case GFEXP: case GFSQRT: case GFNEG: -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GFABS: case GNEG: case GNOT: @@ -2704,7 +2704,7 @@ void mark_graph_2 (register INSTRUCTION_GRAPH graph) case GFEXP: case GFSQRT: case GFNEG: -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GFABS: case GNEG: case GNOT: @@ -2882,7 +2882,7 @@ void mark_graph_1 (register INSTRUCTION_GRAPH graph) case GFEXP: case GFSQRT: case GFNEG: -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GFABS: case GNEG: case GNOT: @@ -192,7 +192,7 @@ int no_time_profiling; # define g_remu(g1,g2) g_instruction_2(GREMU,(g1),(g2)) #endif #define g_mul(g1,g2) g_instruction_2(GMUL,(g1),(g2)) -#ifdef I486 +#if defined (I486) || defined (G_POWER) # define g_neg(g1) g_instruction_1(GNEG,(g1)) # define g_not(g1) g_instruction_1(GNOT,(g1)) #endif @@ -451,7 +451,7 @@ static void code_dyadic_sane_operator (LABEL *label) #endif } -#ifdef I486 +#if defined (I486) || defined (G_POWER) void code_absR (void) { code_monadic_real_operator (GFABS); @@ -4337,7 +4337,7 @@ void code_nu (int a_size,int b_size,char *descriptor_name,char *ea_label_name) last_block->block_ea_label=NULL; } -#ifdef I486 +#if defined (I486) || defined (G_POWER) void code_negI (void) { INSTRUCTION_GRAPH graph_1,graph_2; @@ -4381,7 +4381,7 @@ void code_not (VOID) INSTRUCTION_GRAPH graph_1,graph_2,graph_3; graph_1=s_get_b (0); -#ifdef I486 +#if defined (I486) || defined (G_POWER) graph_3=g_not (graph_1); #else graph_2=g_load_i (-1); @@ -15,7 +15,7 @@ # define ULONG unsigned long #endif -#ifdef I486 +#if defined (I486) || defined (G_POWER) void code_absR (void); #endif void code_acosR (VOID); @@ -153,7 +153,7 @@ void code_mulI (VOID); void code_mulIo (VOID); #endif void code_mulR (VOID); -#ifdef I486 +#if defined (I486) || defined (G_POWER) void code_negI (void); #endif void code_negR (VOID); @@ -15,11 +15,14 @@ enum { GMOVEMI, GMUL, GMUL_O, GOR, GREGISTER, GSTORE, GSTORE_R, GSTORE_B_X, GSTORE_X, GSUB, GSUB_O, GTEST_O, GEXIT_IF +#if defined (I486) || defined (G_POWER) + ,GFABS, GNEG, GNOT +#endif #ifdef G_POWER ,GCREATE_S, GUMULH #endif #ifdef I486 - ,GDIVU, GREMU, GFABS, GNEG, GNOT + ,GDIVU, GREMU #endif }; @@ -49,13 +49,13 @@ enum { ,IMULO #endif #if defined (G_POWER) || defined (I486) - ,IJMPP ,IRTSP + ,IJMPP ,IRTSP, IFABS, INEG, INOT #endif #if defined (I486) && defined (FP_STACK_OPTIMIZATIONS) ,IFEXG #endif #if defined (I486) - ,IRTSI, IDIVI, IREMI, IDIVU, IREMU, IFABS, INEG, INOT + ,IRTSI, IDIVI, IREMI, IDIVU, IREMU #endif #ifdef G_POWER ,IUMULH @@ -1717,7 +1717,7 @@ static void put_instruction_name static void put_instructions_in_table (void) { -#ifdef I486 +#if defined (I486) || defined (G_POWER) put_instruction_name ("absR", parse_instruction, code_absR ); #endif put_instruction_name ("acosR", parse_instruction, code_acosR ); @@ -1849,7 +1849,7 @@ static void put_instructions_in_table (void) put_instruction_name ("modI", parse_instruction, code_remI ); put_instruction_name ("mulI", parse_instruction, code_mulI ); put_instruction_name ("mulR", parse_instruction, code_mulR ); -#ifdef I486 +#if defined (I486) || defined (G_POWER) put_instruction_name ("negI", parse_instruction, code_negI ); #endif put_instruction_name ("negR", parse_instruction, code_negR ); @@ -3380,7 +3380,7 @@ static void linearize_dyadic_non_commutative_data_operator (int i_instruction_co register_node (graph,reg_1); } -#ifdef I486 +#if defined (I486) || defined (G_POWER) static void linearize_monadic_data_operator (int i_instruction_code,INSTRUCTION_GRAPH graph,ADDRESS *ad_p) { INSTRUCTION_GRAPH graph_1; @@ -6107,7 +6107,7 @@ static void linearize_float_graph (register INSTRUCTION_GRAPH graph,register ADD case GFNEG: linearize_monadic_float_operator (graph,ad_p,IFNEG); break; -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GFABS: linearize_monadic_float_operator (graph,ad_p,IFABS); break; @@ -7637,7 +7637,7 @@ static void linearize_graph (INSTRUCTION_GRAPH graph,ADDRESS *ad_p) case GFILL_R: linearize_fill_r_operator (graph,ad_p); return; -#ifdef I486 +#if defined (I486) || defined (G_POWER) case GNEG: linearize_monadic_data_operator (INEG,graph,ad_p); return; @@ -419,7 +419,7 @@ IF_G_POWER ( case IUMULH: ) #if !defined (G_POWER) case IFSQRT: #endif -#ifdef I486 +#if defined (G_POWER) || defined (I486) case IFABS: #endif return 8; @@ -1574,7 +1574,7 @@ IF_G_POWER ( case IUMULH: ) #if !defined (G_POWER) case IFSQRT: #endif -#ifdef I486 +#if defined (G_POWER) || defined (I486) case IFABS: #endif IF_G_SPARC (case IFMOVEHI: case IFMOVELO:) @@ -3857,7 +3857,7 @@ IF_G_POWER (case ICMPLW:) #if !defined (G_POWER) case IFSQRT: #endif -#ifdef I486 +#if defined (G_POWER) || defined (I486) case IFABS: #endif IF_G_SPARC (case IFMOVEHI: case IFMOVELO:) @@ -515,6 +515,7 @@ static unsigned char real_reg_num [32] = # define as_dcbz(ra,rb) store_instruction ((31<<26)|(reg_num(ra)<<16)|(reg_num(rb)<<11)|(1014<<1)) #endif #define as_extb(ra,rb) store_instruction ((31<<26)|(reg_num(ra)<<21)|(reg_num(rb)<<16)|(954<<1)) +#define as_fabs(fd,fb) as_i_dac (264,(fd),0,(fb)) #define as_fadd(fd,fa,fc) as_i_dac (21,(fd),(fa),(fc)) #define as_fcmpu(fa,fb) as_i_dac (0,0,(fa),(fb)) #define as_fctiw(fd,fb) as_i_dac (14,(fd),0,(fb)) @@ -551,6 +552,8 @@ static unsigned char real_reg_num [32] = #define as_mulli(rd,ra,si) as_i_dai (7,rd,ra,si) #define as_mullw(rd,ra,rb) as_i_dab (rd,ra,rb,235) #define as_mullwo_(rd,ra,rb)as_i_dabo_ (rd,ra,rb,235) +#define as_nand(ra,rs,rb) as_i_sab (rs,ra,rb,476) +#define as_neg(rd,ra) store_instruction ((31<<26)|(reg_num(rd)<<21)|(reg_num(ra)<<16)|(104<<1)) #define as_nop() store_instruction (24<<26) #define as_or(ra,rs,rb) as_i_sab (rs,ra,rb,444) #define as_ori(ra,rs,si) as_i_dai (24,rs,ra,si) @@ -1694,6 +1697,16 @@ static void as_jmpp_instruction (struct instruction *instruction) } } +static void as_neg_instruction (struct instruction *instruction) +{ + as_neg (instruction->instruction_parameters[0].parameter_data.reg.r,instruction->instruction_parameters[0].parameter_data.reg.r); +} + +static void as_not_instruction (struct instruction *instruction) +{ + as_nand (instruction->instruction_parameters[0].parameter_data.reg.r,instruction->instruction_parameters[0].parameter_data.reg.r,instruction->instruction_parameters[0].parameter_data.reg.r); +} + static void write_c (int c) { fputc (c,output_file); @@ -2444,6 +2457,15 @@ static void as_fneg_instruction (struct instruction *instruction) as_fneg (instruction->instruction_parameters[1].parameter_data.reg.r+14,freg+14); } +static void as_fabs_instruction (struct instruction *instruction) +{ + int freg; + + freg=as_float_parameter (instruction->instruction_parameters[0]); + + as_fabs (instruction->instruction_parameters[1].parameter_data.reg.r+14,freg+14); +} + static void as_compare_float_instruction (struct instruction *instruction) { int freg; @@ -2811,6 +2833,15 @@ static void write_instructions (struct instruction *instructions) case IEXTB: as_extb_instruction (instruction); break; + case INEG: + as_neg_instruction (instruction); + break; + case INOT: + as_not_instruction (instruction); + break; + case IFABS: + as_fabs_instruction (instruction); + break; case IFMOVE: instruction=as_fmove_instruction (instruction); break; @@ -1468,6 +1468,21 @@ static void w_as_jmpp_instruction (struct instruction *instruction) } } +static void w_as_neg_instruction (struct instruction *instruction) +{ + w_as_opcode ("neg"); + w_as_register_comma (instruction->instruction_parameters[0].parameter_data.reg.r); + w_as_register_newline (instruction->instruction_parameters[0].parameter_data.reg.r); +} + +static void w_as_not_instruction (struct instruction *instruction) +{ + w_as_opcode ("nand"); + w_as_register_comma (instruction->instruction_parameters[0].parameter_data.reg.r); + w_as_register_comma (instruction->instruction_parameters[0].parameter_data.reg.r); + w_as_register_newline (instruction->instruction_parameters[0].parameter_data.reg.r); +} + struct call_and_jump { struct call_and_jump * cj_next; WORD cj_label_id; @@ -3131,9 +3146,18 @@ static void w_as_instructions (register struct instruction *instruction) case IEXTB: w_as_extb_instruction (instruction); break; + case INEG: + w_as_neg_instruction (instruction); + break; + case INOT: + w_as_not_instruction (instruction); + break; case IFMOVE: instruction=w_as_fmove_instruction (instruction); break; + case IFABS: + w_as_dyadic_float_instruction (instruction,"fabs"); + break; case IFADD: w_as_tryadic_float_instruction (instruction,"fadd"); break; |