Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
April 23, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 ponce <aliloko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |backend, SIMD, wrong-code -- |
April 24, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> --- A smaller test with -O -unittest : import core.simd; unittest { align(16) double[2] A = [56.0, -74.0]; } unittest { double[2] A = [56.0, -75.0]; double2 R = cast(double2) __simd(XMM.LODUPD, *A.ptr); assert(R.array == A); } void main() { } -- |
April 24, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> --- The problem is with the lines: double[2] A = [56.0, -75.0]; double2 R = cast(double2) __simd(XMM.LODUPD, *A.ptr); LODUPD (actually MOVUPD) reads two doubles. The code passes it a double lvalue. The optimizer replaces the double with a reference to 56.0. The second double the LODUPD reads is whatever is after the 56.0. This problem can be fixed with a cast to double2 so the optimizer knows it's a 16 byte operation: double2 R = cast(double2) __simd(XMM.LODUPD, *cast(double2*)A.ptr); I'm not really sure what to do about this as __simd does not do type checking on its arguments, which is why it's @system code. I'll leave it open for now. -- |
April 24, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> --- https://github.com/dlang/druntime/pull/3808 -- |
April 24, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> --- Decided to add this as an example in the documentation, so it can be closed. -- |
April 24, 2022 [Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23048 --- Comment #5 from ponce <aliloko@gmail.com> --- Fine for me, I wasn't sure about my code anyway. -- |
Copyright © 1999-2021 by the D Language Foundation