llvm.org GIT mirror llvm / 5891510
fix minsize detection: minsize attribute implies optimizing for size git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244458 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 4 years ago
2 changed file(s) with 8 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
51875187 // TODO: If multiple splats are generated to load the same constant,
51885188 // it may be detrimental to overall size. There needs to be a way to detect
51895189 // that condition to know if this is truly a size win.
5190 const Function *F = DAG.getMachineFunction().getFunction();
5191 // FIXME: Use Function::optForSize().
5192 bool OptForSize = F->hasFnAttribute(Attribute::OptimizeForSize);
5190 bool OptForSize = DAG.getMachineFunction().getFunction()->optForSize();
51935191
51945192 // Handle broadcasting a single constant scalar from the constant pool
51955193 // into a vector.
1313 ; CHECK-NEXT: retq
1414 }
1515
16 define <4 x double> @splat_v4f64(<4 x double> %x) #0 {
16 define <4 x double> @splat_v4f64(<4 x double> %x) #1 {
1717 %add = fadd <4 x double> %x,
1818 ret <4 x double> %add
1919 ; CHECK-LABEL: splat_v4f64
3131 ; CHECK-NEXT: retq
3232 }
3333
34 define <8 x float> @splat_v8f32(<8 x float> %x) #0 {
34 define <8 x float> @splat_v8f32(<8 x float> %x) #1 {
3535 %add = fadd <8 x float> %x,
3636 ret <8 x float> %add
3737 ; CHECK-LABEL: splat_v8f32
6666 }
6767
6868 ; AVX can't do integer splats, so fake it: use vbroadcastss to splat 32-bit value.
69 define <4 x i32> @splat_v4i32(<4 x i32> %x) #0 {
69 define <4 x i32> @splat_v4i32(<4 x i32> %x) #1 {
7070 %add = add <4 x i32> %x,
7171 ret <4 x i32> %add
7272 ; CHECK-LABEL: splat_v4i32
9090 }
9191
9292 ; AVX can't do integer splats, and there's no broadcast fakery for 16-bit. Could use pshuflw, etc?
93 define <8 x i16> @splat_v8i16(<8 x i16> %x) #0 {
93 define <8 x i16> @splat_v8i16(<8 x i16> %x) #1 {
9494 %add = add <8 x i16> %x,
9595 ret <8 x i16> %add
9696 ; CHECK-LABEL: splat_v8i16
114114 }
115115
116116 ; AVX can't do integer splats, and there's no broadcast fakery for 8-bit. Could use pshufb, etc?
117 define <16 x i8> @splat_v16i8(<16 x i8> %x) #0 {
117 define <16 x i8> @splat_v16i8(<16 x i8> %x) #1 {
118118 %add = add <16 x i8> %x,
119119 ret <16 x i8> %add
120120 ; CHECK-LABEL: splat_v16i8
143143
144144 @A = common global <3 x i64> zeroinitializer, align 32
145145
146 define <8 x i64> @pr23259() #0 {
146 define <8 x i64> @pr23259() #1 {
147147 entry:
148148 %0 = load <4 x i64>, <4 x i64>* bitcast (<3 x i64>* @A to <4 x i64>*), align 32
149149 %1 = shufflevector <4 x i64> %0, <4 x i64> undef, <3 x i32>
152152 }
153153
154154 attributes #0 = { optsize }
155 attributes #1 = { minsize }