Skip to content

vector miscompile from AArch64 backend #121372

@regehr

Description

@regehr

here's a function:

define i32 @f(<4 x i32> %0) {
  %2 = icmp ule <4 x i32> %0, zeroinitializer
  %3 = sext <4 x i1> %2 to <4 x i32>
  %4 = icmp sge <4 x i32> zeroinitializer, %3
  %5 = extractelement <4 x i1> %4, i32 0
  %6 = sext i1 %5 to i32
  ret i32 %6
}

if we pass <4 x i32><i32 0, i32 3, i32 3, i32 3> as an argument, it should return -1.
but the AArch64 backend gives:

_f:                        
	fmov	w8, s0
	cmp	w8, #0
	cset	w8, eq
	cmp	w8, #1
	csetm	w0, lt
	ret

which returns 0 for this input.
cc @nunoplopes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions