llvm-project
ded7b288 - [X86] Prefer MOVD/MOVSS over EXTRACTPS $0 for element 0 of v4f32 (#229730)

Commit
4 days ago
[X86] Prefer MOVD/MOVSS over EXTRACTPS $0 for element 0 of v4f32 (#229730) Extracting element 0 of a `v4f32` into a GPR currently selects `VEXTRACTPS $0` instead of the shorter and cheaper `VMOVD`. This is because the pattern `(extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2)` accepts any index, including 0. And since it has a higher complexity than the `(extractelt (v4i32 VR128), 0)` pattern that we want it gets selected. So this adds a peephole to X86FixupInstTuning that rewrites EXTRACTPS with index 0 this turns: `EXTRACTPS` into `MOVPDI2D` `VEXTRACTPS` into `VMOVPDI2D` `VEXTRACTPSZ` into `VMOVPDI2DIZ` Used AI for checking and test case generation.
Author
Parents
Loading