mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[InstCombine] add tests for extract of vector load; NFC
There's a mismatch internally about how we are handling these patterns. We count loads as cheapToScalarize(), but then we don't actually scalarize them, so that can leave extra instructions compared to where we started when scalarizing other ops. If it's cheapToScalarize, then we should be scalarizing. llvm-svn: 349560
This commit is contained in:
parent
a8a3f9cd5a
commit
fb3ac2f186
@ -1,6 +1,63 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -instcombine -S < %s | FileCheck %s
|
||||
|
||||
define i32 @extract_load(<4 x i32>* %p) {
|
||||
; CHECK-LABEL: @extract_load(
|
||||
; CHECK-NEXT: [[X:%.*]] = load <4 x i32>, <4 x i32>* [[P:%.*]], align 4
|
||||
; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x i32> [[X]], i32 1
|
||||
; CHECK-NEXT: ret i32 [[EXT]]
|
||||
;
|
||||
%x = load <4 x i32>, <4 x i32>* %p, align 4
|
||||
%ext = extractelement <4 x i32> %x, i32 1
|
||||
ret i32 %ext
|
||||
}
|
||||
|
||||
define double @extract_load_fp(<4 x double>* %p) {
|
||||
; CHECK-LABEL: @extract_load_fp(
|
||||
; CHECK-NEXT: [[X:%.*]] = load <4 x double>, <4 x double>* [[P:%.*]], align 32
|
||||
; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x double> [[X]], i32 3
|
||||
; CHECK-NEXT: ret double [[EXT]]
|
||||
;
|
||||
%x = load <4 x double>, <4 x double>* %p, align 32
|
||||
%ext = extractelement <4 x double> %x, i32 3
|
||||
ret double %ext
|
||||
}
|
||||
|
||||
define double @extract_load_volatile(<4 x double>* %p) {
|
||||
; CHECK-LABEL: @extract_load_volatile(
|
||||
; CHECK-NEXT: [[X:%.*]] = load volatile <4 x double>, <4 x double>* [[P:%.*]], align 32
|
||||
; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x double> [[X]], i32 2
|
||||
; CHECK-NEXT: ret double [[EXT]]
|
||||
;
|
||||
%x = load volatile <4 x double>, <4 x double>* %p
|
||||
%ext = extractelement <4 x double> %x, i32 2
|
||||
ret double %ext
|
||||
}
|
||||
|
||||
define double @extract_load_extra_use(<4 x double>* %p, <4 x double>* %p2) {
|
||||
; CHECK-LABEL: @extract_load_extra_use(
|
||||
; CHECK-NEXT: [[X:%.*]] = load <4 x double>, <4 x double>* [[P:%.*]], align 8
|
||||
; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x double> [[X]], i32 0
|
||||
; CHECK-NEXT: store <4 x double> [[X]], <4 x double>* [[P2:%.*]], align 32
|
||||
; CHECK-NEXT: ret double [[EXT]]
|
||||
;
|
||||
%x = load <4 x double>, <4 x double>* %p, align 8
|
||||
%ext = extractelement <4 x double> %x, i32 0
|
||||
store <4 x double> %x, <4 x double>* %p2
|
||||
ret double %ext
|
||||
}
|
||||
|
||||
define double @extract_load_variable_index(<4 x double>* %p, i32 %y) {
|
||||
; CHECK-LABEL: @extract_load_variable_index(
|
||||
; CHECK-NEXT: [[X:%.*]] = load <4 x double>, <4 x double>* [[P:%.*]], align 32
|
||||
; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x double> [[X]], i32 [[Y:%.*]]
|
||||
; CHECK-NEXT: ret double [[EXT]]
|
||||
;
|
||||
%x = load <4 x double>, <4 x double>* %p
|
||||
%ext = extractelement <4 x double> %x, i32 %y
|
||||
ret double %ext
|
||||
}
|
||||
|
||||
define void @scalarize_phi(i32 * %n, float * %inout) {
|
||||
; CHECK-LABEL: @scalarize_phi(
|
||||
; CHECK-NEXT: entry:
|
||||
|
Loading…
Reference in New Issue
Block a user