the following program (.i attached) prints: 44 33 22 11 00 00 00 00 44 33 22 11 00 00 00 00 44 33 22 11 00 00 00 00 instead of the expected: 88 77 66 55 44 33 22 11 88 77 66 55 44 33 22 11 88 77 66 55 44 33 22 11 the generated assembly uses a movd to fill in %mm0, leaving the upper 32-bits empty. // gcc -O -mmmx -o set64 set64.c #include <mmintrin.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> void memset64(void *dst, uint32_t hi, uint32_t lo, size_t count) { __m64 *p = (__m64 *)dst; __m64 fill = _mm_set_pi32(hi, lo); while (count--) { *p++ = fill; } } #define NUM 3 int main() { uint8_t *buf = (uint8_t *)calloc(NUM * 2, sizeof(uint32_t)); int i, count = NUM * 2 * sizeof(uint32_t); memset64(buf, 0x11223344, 0x55667788, NUM); for (i = 0; i < count; i++) { printf("%02x ", buf[i]); } printf("\n"); return 0; } Release: gcc-3.2.2 Environment: Mandrake Linux 9.1.1 How-To-Repeat: run attached program built with -O -mmmx
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed on 3.2 branch. 3.3 and mainline are not affected.
Responsible-Changed-From-To: unassigned->ebotcazou Responsible-Changed-Why: Investigating.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3.