Jan. 16th, 2018

izard: (Default)
A hotspot inside a nested loop:
__m128i result = _mm_add_epi32(a, b);
return ((uint16_t*)&result)[1];

This compiles to:
VPADD XMM2, XMM3, XMM1
MOVD XMM1, ESP(100)
MOV ESP(102), EAX

Blocked store forwarding, CPI 3+, too slow.
What if I try to get rid of the long store forward block penalty using an obvious workaround:
return ((uint32_t*)&result)[0]>>16;

Then compiler will still generate:
MOVD XMM1, ESP(100)
MOV ESP(102), EAX

Good compiler, smart! It won't let me do
MOVD XMM1, EAX
ROL EAX, 16

no matter what, even above as inline assembly it does not like.

Profile

izard: (Default)
izard

September 2025

S M T W T F S
 1 23456
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 7th, 2025 10:52 am
Powered by Dreamwidth Studios