Skip to content

incorrect instruction selected for materializing 4-way add of 0x01010101 #33619

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 34271
Resolution FIXED
Resolved on Aug 22, 2017 09:17
Version trunk
OS All
Blocks #33196
CC @chandlerc,@topperc,@zmodem,@RKSimon,@rotateright

Extended Description

We miscompile ffmpeg's mjpegenc_common.c due to a bad instruction being selected to materialize a vector constant. Testcase:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define <4 x i32> @​f(<4 x i32> %a) {
%v = add nuw nsw <4 x i32> %a, <i32 16843009, i32 16843009, i32 16843009, i32 16843009>
ret <4 x i32> %v
}

This compiles to:

    pcmpeqd %xmm1, %xmm1
    psubd   %xmm1, %xmm0

... which computes %a + {1, 1, 1, 1}, not %a + {0x01010101, 0x01010101, 0x01010101, 0x01010101}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions