Hi,
Could a gate keeper please review the attached patch which fixes bug 972?
Fix:
movlhps and movhlps instructions are not handled correctly in both avx and
non-avx mode. The problem is exposed with intrinsics and the bug is fixed with
the patch.
Thanks,
Shivaram
Index: osprey/be/cg/x8664/expand.cxx
===================================================================
--- osprey/be/cg/x8664/expand.cxx (revision 3921)
+++ osprey/be/cg/x8664/expand.cxx (working copy)
@@ -5984,7 +5984,11 @@
Build_OP(TOP_shufpd, tmp26, tmp25, tmp25, Gen_Literal_TN(1, 1), ops);
Build_OP(TOP_fdiv128v64, tmp27, tmp26, tmp24, ops);
Build_OP(TOP_cvtpd2ps, tmp28, tmp27, ops);
- Build_OP(TOP_movlhps, result, tmp28, ops);
+ if (Is_Target_Orochi() && Is_Target_AVX()) {
+ Build_OP(TOP_movlhps, result, result, tmp28, ops);
+ } else {
+ Build_OP(TOP_movlhps, result, tmp28, ops);
+ }
}
Set_OP_cond_def_kind( OPS_last(ops), OP_ALWAYS_COND_DEF );
@@ -6726,10 +6730,11 @@
case OPC_V16F8V16F8SHUFFLE:
if (Is_Target_Orochi() && Is_Target_AVX()) {
Build_OP(TOP_movhlps, result, op1, op1, ops);
+ Build_OP(TOP_movlhps, result, result, op1, ops);
} else {
Build_OP(TOP_movhlps, result, op1, ops);
+ Build_OP(TOP_movlhps, result, op1, ops);
}
- Build_OP(TOP_movlhps, result, op1, ops);
Set_OP_cond_def_kind( OPS_last(ops), OP_ALWAYS_COND_DEF );
break;
case OPC_V16I2V16I2SHUFFLE:
@@ -6738,10 +6743,11 @@
TN* tmp2 = Build_TN_Like(result);
if (Is_Target_Orochi() && Is_Target_AVX()) {
Build_OP(TOP_movhlps, tmp1, op1, op1, ops);
+ Build_OP(TOP_movlhps, tmp1, tmp1, op1, ops);
} else {
Build_OP(TOP_movhlps, tmp1, op1, ops);
+ Build_OP(TOP_movlhps, tmp1, op1, ops);
}
- Build_OP(TOP_movlhps, tmp1, op1, ops);
Set_OP_cond_def_kind( OPS_last(ops), OP_ALWAYS_COND_DEF );
Build_OP(TOP_pshuflw, tmp2, tmp1, Gen_Literal_TN(0x1B, 1), ops);
Build_OP(TOP_pshufhw, result, tmp2, Gen_Literal_TN(0x1B, 1), ops);
@@ -8071,10 +8077,24 @@
Build_OP( TOP_movsd, result, op0, op1, ops );
break;
case INTRN_MOVHLPS:
- Build_OP( TOP_movhlps, result, op0, op1, ops );
+ if (Is_Target_Orochi() && Is_Target_AVX()) {
+ Build_OP( TOP_movhlps, result, op0, op1, ops );
+ } else {
+ // do packing of op1[2] op1[3] op0[2] op0[3] in result
+ Build_OP(TOP_shufps, result, op0, op1, Gen_Literal_TN(187, 1), ops);
+ // reverse fields to get op0[3] op0[2] op1[3] op1[2]
+ Build_OP(TOP_shufps, result, result, result, Gen_Literal_TN(27, 1), ops);
+ }
+
break;
case INTRN_MOVLHPS:
- Build_OP( TOP_movlhps, result, op0, op1, ops );
+ if (Is_Target_Orochi() && Is_Target_AVX()) {
+ Build_OP( TOP_movlhps, result, op0, op1, ops );
+ } else {
+ // do packing of op1[1] op1[0] op0[1] op0[0] in result
+ Build_OP(TOP_shufps, result, op0, op1, Gen_Literal_TN(68, 1), ops);
+ }
+
break;
case INTRN_UNPCKHPS:
Build_OP( TOP_unpckhps, result, op0, op1, ops );
Index: osprey/common/targ_info/isa/x8664/isa_operands.cxx
===================================================================
--- osprey/common/targ_info/isa/x8664/isa_operands.cxx (revision 3921)
+++ osprey/common/targ_info/isa/x8664/isa_operands.cxx (working copy)
@@ -1194,6 +1194,7 @@
TOP_vfminsd,
TOP_vfminss,
TOP_vmovhlps,
+ TOP_vmovlhps,
TOP_vfmul128v64,
TOP_vfmul128v32,
TOP_vmulsd,
@@ -4570,7 +4571,6 @@
Operand(3, uimm8, opnd2);
Instruction_Group("move-high-low",
- TOP_vmovlhps,
TOP_movlhps,
TOP_movhlps,
TOP_UNDEFINED);
Index: osprey/common/targ_info/isa/x8664/isa_print.cxx
===================================================================
--- osprey/common/targ_info/isa/x8664/isa_print.cxx (revision 3921)
+++ osprey/common/targ_info/isa/x8664/isa_print.cxx (working copy)
@@ -1525,16 +1525,6 @@
TOP_UNDEFINED );
/* dest=op(src1, src2), non-x86-style */
- ISA_PRINT_TYPE vropspec = ISA_Print_Type_Create("vropspec", "%s %s,%s,%s");
- Name();
- Operand(0);
- Result(0);
- Result(0);
- Instruction_Print_Group( vropspec,
- TOP_vmovlhps,
- TOP_UNDEFINED );
-
- /* dest=op(src1, src2), non-x86-style */
ISA_PRINT_TYPE vropop = ISA_Print_Type_Create("vropop", "%s %s,%s,%s");
Name();
Operand(1);
@@ -1640,6 +1630,7 @@
TOP_vpmaddwd,
TOP_vpmaddubsw128,
TOP_vmovhlps,
+ TOP_vmovlhps,
TOP_vmovsd,
TOP_vmovss,
TOP_vmaxs128v8,
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel