Issue 136746
Summary fshr-related miscompile by AArch64 backend
Labels backend:AArch64, llvm:codegen, miscompilation
Assignees
Reporter regehr
    here's a function:
```llvm
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.fshr.i64(i64, i64, i64) #0

define i1 @f(i64 %0) {
  %2 = or i64 1, %0
  %3 = call i64 @llvm.fshr.i64(i64 %2, i64 %0, i64 0)
  %4 = icmp uge i64 0, %3
  ret i1 %4
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```
the AArch64 backend lowers it as follows:
```
_f:
	mov	w0, wzr
	ret
```
but `f(0)` should evaluate to 1 (and it does when compiled using Apple's latest clang)

(test case generated by @dtcxzyw's mutator)

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to