Bug 15154 – Wrong overload resolution with implicit conversion of other vectorized parameter __vector(void[16])

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-10-04T16:30:00Z
Last change time
2017-01-17T15:06:47Z
Keywords
SIMD
Assigned to
nobody
Creator
nachtraaf80

Comments

Comment #0 by nachtraaf80 — 2015-10-04T16:30:02Z
Overload resolution seems to see float and double as matching types when another function parameter is implicitly converted (float4 to void16). float dot_simd1(float4 a, float4 b) { float4 result = __simd(XMM.DPPS, a, b, 0xFF); float value; __simd_sto(XMM.STOSS, value, result); return value; } The following error is produced by the code above: simd1.d(34): Error: core.simd.__simd_sto called with argument types (XMM, float, __vector(float[4])) matches both: /usr/include/dlang/dmd/core/simd.d(434): core.simd.__simd_sto(XMM opcode, double op1, __vector(void[16]) op2) and: /usr/include/dlang/dmd/core/simd.d(435): core.simd.__simd_sto(XMM opcode, float op1, __vector(void[16]) op2) When casting to the correct type (void16) the code compiles without errors: float dot_simd1(float4 a, float4 b) { float4 result = __simd(XMM.DPPS, a, b, 0xFF); float value; __simd_sto(XMM.STOSS, value, cast(void16)result); return value; }
Comment #1 by bitter.taste — 2017-01-17T15:06:47Z
Not much of a bug here, in the first snippet you're calling __simd_sto with [XMM, float, float4] which is a MATCHconvert for both the overloads of the __simd_sto. On the other hand when you explicitly cast the vector to void16 we get a MATCHconvert for the [XMM, double, void16] overload (note the float -> double conversion) and a MATCHperfect for [XMM, float, void16] so that's what is picked.