OLD | NEW |
1 //===- subzero/unittest/AssemblerX8664/XmmArith.cpp -----------------------===// | 1 //===- subzero/unittest/AssemblerX8664/XmmArith.cpp -----------------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 #include "AssemblerX8664/TestUtil.h" | 9 #include "AssemblerX8664/TestUtil.h" |
10 | 10 |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 TestImpl(xmm13, xmm14); | 1076 TestImpl(xmm13, xmm14); |
1077 TestImpl(xmm14, xmm15); | 1077 TestImpl(xmm14, xmm15); |
1078 TestImpl(xmm15, xmm0); | 1078 TestImpl(xmm15, xmm0); |
1079 | 1079 |
1080 #undef TestImpl | 1080 #undef TestImpl |
1081 #undef TestImplSingleXmmXmmUntyped | 1081 #undef TestImplSingleXmmXmmUntyped |
1082 #undef TestImplSingleXmmAddr | 1082 #undef TestImplSingleXmmAddr |
1083 #undef TestImplSingleXmmXmm | 1083 #undef TestImplSingleXmmXmm |
1084 } | 1084 } |
1085 | 1085 |
| 1086 TEST_F(AssemblerX8664Test, Punpckldq) { |
| 1087 const Dqword V0(uint64_t(0x1111111122222222ull), |
| 1088 uint64_t(0x5555555577777777ull)); |
| 1089 const Dqword V1(uint64_t(0xAAAAAAAABBBBBBBBull), |
| 1090 uint64_t(0xCCCCCCCCDDDDDDDDull)); |
| 1091 |
| 1092 const Dqword Expected(uint64_t(0xBBBBBBBB22222222ull), |
| 1093 uint64_t(0xAAAAAAAA11111111ull)); |
| 1094 |
| 1095 #define TestImplXmmXmm(Dst, Src, Inst) \ |
| 1096 do { \ |
| 1097 static constexpr char TestString[] = "(" #Dst ", " #Src ", " #Inst ")"; \ |
| 1098 const uint32_t T0 = allocateDqword(); \ |
| 1099 const uint32_t T1 = allocateDqword(); \ |
| 1100 \ |
| 1101 __ movups(XmmRegister::Encoded_Reg_##Dst, dwordAddress(T0)); \ |
| 1102 __ movups(XmmRegister::Encoded_Reg_##Src, dwordAddress(T1)); \ |
| 1103 __ Inst(IceType_void, XmmRegister::Encoded_Reg_##Dst, \ |
| 1104 XmmRegister::Encoded_Reg_##Src); \ |
| 1105 \ |
| 1106 AssembledTest test = assemble(); \ |
| 1107 test.setDqwordTo(T0, V0); \ |
| 1108 test.setDqwordTo(T1, V1); \ |
| 1109 test.run(); \ |
| 1110 \ |
| 1111 ASSERT_EQ(Expected, test.Dst<Dqword>()) << TestString; \ |
| 1112 reset(); \ |
| 1113 } while (0) |
| 1114 |
| 1115 #define TestImplXmmAddr(Dst, Inst) \ |
| 1116 do { \ |
| 1117 static constexpr char TestString[] = "(" #Dst ", Addr, " #Inst ")"; \ |
| 1118 const uint32_t T0 = allocateDqword(); \ |
| 1119 const uint32_t T1 = allocateDqword(); \ |
| 1120 \ |
| 1121 __ movups(XmmRegister::Encoded_Reg_##Dst, dwordAddress(T0)); \ |
| 1122 __ Inst(IceType_void, XmmRegister::Encoded_Reg_##Dst, dwordAddress(T1)); \ |
| 1123 \ |
| 1124 AssembledTest test = assemble(); \ |
| 1125 test.setDqwordTo(T0, V0); \ |
| 1126 test.setDqwordTo(T1, V1); \ |
| 1127 test.run(); \ |
| 1128 \ |
| 1129 ASSERT_EQ(Expected, test.Dst<Dqword>()) << TestString; \ |
| 1130 reset(); \ |
| 1131 } while (0) |
| 1132 |
| 1133 #define TestImpl(Dst, Src) \ |
| 1134 do { \ |
| 1135 TestImplXmmXmm(Dst, Src, punpckldq); \ |
| 1136 TestImplXmmAddr(Dst, punpckldq); \ |
| 1137 } while (0) |
| 1138 |
| 1139 TestImpl(xmm0, xmm1); |
| 1140 TestImpl(xmm1, xmm2); |
| 1141 TestImpl(xmm2, xmm3); |
| 1142 TestImpl(xmm3, xmm4); |
| 1143 TestImpl(xmm4, xmm5); |
| 1144 TestImpl(xmm5, xmm6); |
| 1145 TestImpl(xmm6, xmm7); |
| 1146 TestImpl(xmm7, xmm8); |
| 1147 TestImpl(xmm8, xmm9); |
| 1148 TestImpl(xmm9, xmm10); |
| 1149 TestImpl(xmm10, xmm11); |
| 1150 TestImpl(xmm11, xmm12); |
| 1151 TestImpl(xmm12, xmm13); |
| 1152 TestImpl(xmm13, xmm14); |
| 1153 TestImpl(xmm14, xmm15); |
| 1154 TestImpl(xmm15, xmm0); |
| 1155 |
| 1156 #undef TestImpl |
| 1157 #undef TestImplXmmAddr |
| 1158 #undef TestImplXmmXmm |
| 1159 } |
| 1160 |
1086 TEST_F(AssemblerX8664Test, Cvt) { | 1161 TEST_F(AssemblerX8664Test, Cvt) { |
1087 const Dqword dq2ps32DstValue(-1.0f, -1.0f, -1.0f, -1.0f); | 1162 const Dqword dq2ps32DstValue(-1.0f, -1.0f, -1.0f, -1.0f); |
1088 const Dqword dq2ps32SrcValue(-5, 3, 100, 200); | 1163 const Dqword dq2ps32SrcValue(-5, 3, 100, 200); |
1089 const Dqword dq2ps32Expected(-5.0f, 3.0f, 100.0, 200.0); | 1164 const Dqword dq2ps32Expected(-5.0f, 3.0f, 100.0, 200.0); |
1090 | 1165 |
1091 const Dqword dq2ps64DstValue(0.0f, 0.0f, -1.0f, -1.0f); | 1166 const Dqword dq2ps64DstValue(0.0f, 0.0f, -1.0f, -1.0f); |
1092 const Dqword dq2ps64SrcValue(-5, 3, 100, 200); | 1167 const Dqword dq2ps64SrcValue(-5, 3, 100, 200); |
1093 const Dqword dq2ps64Expected(-5.0f, 3.0f, 100.0, 200.0); | 1168 const Dqword dq2ps64Expected(-5.0f, 3.0f, 100.0, 200.0); |
1094 | 1169 |
1095 const Dqword tps2dq32DstValue(-1.0f, -1.0f, -1.0f, -1.0f); | 1170 const Dqword tps2dq32DstValue(-1.0f, -1.0f, -1.0f, -1.0f); |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 TestImpl(xmm14, r1, 101); | 2030 TestImpl(xmm14, r1, 101); |
1956 TestImpl(xmm15, r2, 166); | 2031 TestImpl(xmm15, r2, 166); |
1957 | 2032 |
1958 #undef TestImpl | 2033 #undef TestImpl |
1959 } | 2034 } |
1960 | 2035 |
1961 } // end of anonymous namespace | 2036 } // end of anonymous namespace |
1962 } // end of namespace Test | 2037 } // end of namespace Test |
1963 } // end of namespace X8664 | 2038 } // end of namespace X8664 |
1964 } // end of namespace Ice | 2039 } // end of namespace Ice |
OLD | NEW |