Revision 390efc54 target-cris/translate.c

b/target-cris/translate.c
318 318

  
319 319
	/* y = -(x >> 16)  */
320 320
	tcg_gen_shri_i32(y, x, 16);
321
	tcg_gen_sub_i32(y, tcg_const_i32(0), y);
321
	tcg_gen_neg_i32(y, y);
322 322

  
323 323
	/* m = (y >> 16) & 16  */
324 324
	tcg_gen_sari_i32(m, y, 16);
......
753 753
			t_gen_add_flag(cpu_T[0], 8); /* R_FLAG.  */
754 754
			break;
755 755
		case CC_OP_SUB:
756
			tcg_gen_sub_tl(cpu_T[1], tcg_const_tl(0), cpu_T[1]);
756
			tcg_gen_neg_tl(cpu_T[1], cpu_T[1]);
757 757
			tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
758
			tcg_gen_sub_tl(cpu_T[1], tcg_const_tl(0), cpu_T[1]);
758
			tcg_gen_neg_tl(cpu_T[1], cpu_T[1]);
759 759
			/* CRIS flag evaluation needs ~src.  */
760 760
			tcg_gen_xori_tl(cpu_T[1], cpu_T[1], -1);
761 761

  
......
784 784
			t_gen_asr(cpu_T[0], cpu_T[0], cpu_T[1]);
785 785
			break;
786 786
		case CC_OP_NEG:
787
			/* Hopefully the TCG backend recognizes this pattern
788
			   and makes a real neg out of it.  */
789
			tcg_gen_sub_tl(cpu_T[0], tcg_const_tl(0), cpu_T[1]);
787
			tcg_gen_neg_tl(cpu_T[0], cpu_T[1]);
790 788
			/* Extended arithmetics.  */
791 789
			t_gen_subx_carry(cpu_T[0]);
792 790
			break;
......
829 827
		}
830 828
		break;
831 829
		case CC_OP_CMP:
832
			tcg_gen_sub_tl(cpu_T[1], tcg_const_tl(0), cpu_T[1]);
830
			tcg_gen_neg_tl(cpu_T[1], cpu_T[1]);
833 831
			tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
834 832
			/* CRIS flag evaluation needs ~src.  */
835
			tcg_gen_sub_tl(cpu_T[1], tcg_const_tl(0), cpu_T[1]);
833
			tcg_gen_neg_tl(cpu_T[1], cpu_T[1]);
836 834
			/* CRIS flag evaluation needs ~src.  */
837 835
			tcg_gen_xori_tl(cpu_T[1], cpu_T[1], -1);
838 836

  
......
1642 1640
	/* TODO: consider a branch free approach.  */
1643 1641
	l1 = gen_new_label();
1644 1642
	tcg_gen_brcond_tl(TCG_COND_GE, cpu_T[1], tcg_const_tl(0), l1);
1645
	tcg_gen_sub_tl(cpu_T[1], tcg_const_tl(0), cpu_T[1]);
1643
	tcg_gen_neg_tl(cpu_T[1], cpu_T[1]);
1646 1644
	gen_set_label(l1);
1647 1645
	crisv32_alu_op(dc, CC_OP_MOVE, dc->op2, 4);
1648 1646
	return 2;

Also available in: Unified diff