1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/CodeGen/PowerPC/pr35402.ll
Guozhi Wei 56ba76fe49 [PPC] Avoid non-simple MVT in STBRX optimization
PR35402 triggered this case. It bswap and stores a 48bit value, current STBRX optimization transforms it into STBRX. Unfortunately 48bit is not a simple MVT, there is no PPC instruction to support it, and it can't be automatically expanded by llvm, so caused a crash.

This patch detects the non-simple MVT and returns early.

Differential Revision: https://reviews.llvm.org/D44500

llvm-svn: 327651
2018-03-15 17:49:12 +00:00

19 lines
371 B
LLVM

; RUN: llc -O2 < %s | FileCheck %s
target triple = "powerpc64le-linux-gnu"
define void @test(i8* %p, i64 %data) {
entry:
%0 = tail call i64 @llvm.bswap.i64(i64 %data)
%ptr = bitcast i8* %p to i48*
%val = trunc i64 %0 to i48
store i48 %val, i48* %ptr, align 1
ret void
; CHECK: sth
; CHECK: stw
; CHECK-NOT: stdbrx
}
declare i64 @llvm.bswap.i64(i64)