diff --git a/test/Transforms/InstCombine/scalarization.ll b/test/Transforms/InstCombine/scalarization.ll index a5c5600f0d2..586509542b8 100644 --- a/test/Transforms/InstCombine/scalarization.ll +++ b/test/Transforms/InstCombine/scalarization.ll @@ -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: