Sanjay Patel
ae945e7927
[InstCombine] transform more extract/insert pairs into shuffles (PR2109)
...
This is an extension of the shuffle combining from r203229:
http://reviews.llvm.org/rL203229
The idea is to widen a short input vector with undef elements so the
existing shuffle transform for extract/insert can kick in.
The motivation is to finally solve PR2109:
https://llvm.org/bugs/show_bug.cgi?id=2109
For that example, the IR becomes:
%1 = bitcast <2 x i32>* %P to <2 x float>*
%ld1 = load <2 x float>, <2 x float>* %1, align 8
%2 = shufflevector <2 x float> %ld1, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%i2 = shufflevector <4 x float> %A, <4 x float> %2, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
ret <4 x float> %i2
And x86 SSE output improves from:
movq (%rdi), %xmm1 ## xmm1 = mem[0],zero
movdqa %xmm1, %xmm2
shufps $229, %xmm2, %xmm2 ## xmm2 = xmm2[1,1,2,3]
shufps $48, %xmm0, %xmm1 ## xmm1 = xmm1[0,0],xmm0[3,0]
shufps $132, %xmm1, %xmm0 ## xmm0 = xmm0[0,1],xmm1[0,2]
shufps $32, %xmm0, %xmm2 ## xmm2 = xmm2[0,0],xmm0[2,0]
shufps $36, %xmm2, %xmm0 ## xmm0 = xmm0[0,1],xmm2[2,0]
retq
To the almost optimal:
movhpd (%rdi), %xmm0
Note: There's a tension in the existing transform related to generating
arbitrary shufflevector masks. We avoid that in other places in InstCombine
because we're scared that codegen can't handle strange masks, but it looks
like we're ok with producing those here. I purposely chose weird insert/extract
indexes for the regression tests to see the effect in these cases.
For PowerPC+Altivec, AArch64, and X86+SSE/AVX, I think the codegen is equal or
better for these examples.
Differential Revision: http://reviews.llvm.org/D15096
llvm-svn: 256394
2015-12-24 21:17:56 +00:00
..
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-06-17 20:52:32 +00:00
2015-04-16 23:24:18 +00:00
2015-06-17 20:52:32 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-03-24 21:50:35 +00:00
2015-02-27 21:17:42 +00:00
2015-09-11 03:22:04 +00:00
2015-09-11 03:22:04 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-06-17 20:52:32 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2014-11-24 23:03:17 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-03-13 18:20:45 +00:00
2015-03-13 18:20:45 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-03-13 18:20:45 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-03-13 18:20:45 +00:00
2015-07-14 22:39:23 +00:00
2015-02-27 21:17:42 +00:00
2014-12-01 09:27:46 +00:00
2015-06-17 20:52:32 +00:00
2015-11-19 05:56:52 +00:00
2015-09-11 03:22:04 +00:00
2015-02-27 19:29:02 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 21:17:42 +00:00
2015-07-14 00:11:08 +00:00
2015-02-27 21:17:42 +00:00
2015-05-11 06:37:03 +00:00
2015-10-23 20:37:08 +00:00
2015-12-23 09:58:41 +00:00
2015-10-08 17:09:31 +00:00
2015-08-16 07:09:17 +00:00
2014-11-27 11:22:49 +00:00
2015-01-06 08:41:31 +00:00
2015-09-08 18:36:56 +00:00
2014-10-13 22:37:51 +00:00
2014-09-07 19:21:07 +00:00
2015-02-27 21:17:42 +00:00
2015-10-07 16:01:18 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-09-11 03:22:04 +00:00
2015-12-12 00:33:36 +00:00
2014-12-15 19:07:53 +00:00
2015-12-12 16:44:48 +00:00
2015-12-10 17:09:28 +00:00
2015-11-12 12:39:41 +00:00
2015-12-11 10:04:51 +00:00
2015-02-27 21:17:42 +00:00
2015-08-12 08:08:56 +00:00
2015-03-10 22:52:37 +00:00
2015-08-10 19:56:39 +00:00
2015-10-06 20:20:45 +00:00
2015-09-24 10:24:58 +00:00
2015-04-16 23:24:18 +00:00
2015-09-14 18:10:43 +00:00
2015-03-11 18:03:05 +00:00
2015-11-19 05:56:52 +00:00
2015-06-17 20:52:32 +00:00
2014-12-15 19:07:53 +00:00
2015-02-27 21:17:42 +00:00
2015-11-25 00:42:19 +00:00
2015-09-15 17:51:59 +00:00
2015-08-10 19:01:27 +00:00
2015-12-15 01:44:07 +00:00
2015-10-07 00:20:07 +00:00
2015-09-16 20:41:29 +00:00
2015-03-13 18:20:45 +00:00
2015-03-13 18:20:45 +00:00
2015-09-11 03:22:04 +00:00
2015-03-13 18:20:45 +00:00
2015-03-10 05:13:47 +00:00
2014-10-01 20:36:33 +00:00
2015-02-27 21:17:42 +00:00
2015-06-17 20:52:32 +00:00
2015-10-14 22:42:12 +00:00
2015-11-05 22:03:56 +00:00
2015-11-05 22:03:56 +00:00
2015-03-08 21:53:59 +00:00
2015-04-30 22:05:30 +00:00
2015-09-25 23:21:38 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-10-23 20:37:08 +00:00
2015-03-10 22:43:20 +00:00
2014-10-23 21:52:45 +00:00
2015-02-27 19:29:02 +00:00
2015-04-16 23:24:18 +00:00
2015-12-15 17:24:15 +00:00
2015-12-15 01:44:07 +00:00
2015-10-08 16:56:55 +00:00
2015-12-14 21:59:03 +00:00
2015-03-09 03:20:25 +00:00
2015-11-02 18:00:00 +00:00
2014-12-03 21:46:33 +00:00
2015-02-27 21:17:42 +00:00
2015-09-23 18:40:57 +00:00
2014-11-04 05:17:58 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-05-29 00:04:30 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-09-10 22:35:41 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-03-13 18:20:45 +00:00
2015-10-26 10:25:05 +00:00
2015-04-21 23:02:15 +00:00
2014-11-18 09:31:41 +00:00
2015-09-26 03:26:47 +00:00
2015-09-19 00:48:31 +00:00
2015-12-02 16:15:07 +00:00
2015-12-14 21:59:03 +00:00
2015-12-24 21:17:56 +00:00
2015-07-21 08:52:23 +00:00
2015-02-27 21:17:42 +00:00
2015-06-17 20:52:32 +00:00
2015-03-13 18:20:45 +00:00
2015-11-17 20:13:04 +00:00
2015-11-05 22:03:56 +00:00
2015-03-13 18:20:45 +00:00
2015-07-10 06:55:49 +00:00
2015-05-28 18:39:17 +00:00
2015-05-28 18:39:17 +00:00
2015-12-02 16:15:07 +00:00
2015-11-02 17:53:51 +00:00
2015-11-02 17:53:51 +00:00
2015-11-02 17:53:51 +00:00
2015-10-23 20:37:08 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-11-02 17:53:51 +00:00
2015-11-30 19:38:35 +00:00
2015-12-14 21:59:03 +00:00
2015-02-27 21:17:42 +00:00
2015-12-03 22:45:19 +00:00
2015-04-30 04:56:04 +00:00
2014-10-21 23:00:20 +00:00
2015-02-27 21:17:42 +00:00
2015-03-21 22:04:26 +00:00
2015-08-28 18:30:18 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 21:17:42 +00:00
2015-05-20 18:41:25 +00:00
2015-08-11 09:12:57 +00:00
2015-01-06 23:00:33 +00:00
2015-04-18 04:41:30 +00:00
2015-02-27 21:17:42 +00:00
2014-12-19 17:12:35 +00:00
2015-09-30 10:56:37 +00:00
2015-12-14 21:59:03 +00:00
2015-02-27 21:17:42 +00:00
2015-08-27 03:16:29 +00:00
2014-11-27 10:57:24 +00:00
2015-09-08 17:58:22 +00:00
2015-02-27 21:17:42 +00:00
2015-06-17 20:52:32 +00:00
2015-09-11 03:22:04 +00:00
2015-03-27 22:04:28 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 21:17:42 +00:00
2014-12-09 10:46:38 +00:00
2015-12-02 16:15:07 +00:00
2015-04-16 23:24:18 +00:00
2015-03-04 18:43:29 +00:00
2015-04-10 21:07:09 +00:00
2015-11-02 17:53:51 +00:00
2015-11-02 17:53:51 +00:00
2015-11-02 17:53:51 +00:00
2015-02-27 21:17:42 +00:00
2015-09-27 20:34:31 +00:00
2015-11-02 18:00:00 +00:00
2015-12-04 22:00:47 +00:00
2015-12-14 21:59:03 +00:00
2015-11-03 20:32:23 +00:00
2015-12-14 21:59:03 +00:00
2015-11-18 23:21:32 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-02-27 21:17:42 +00:00
2014-11-21 23:36:44 +00:00
2014-11-21 23:36:44 +00:00
2014-11-21 23:36:44 +00:00
2015-03-04 18:43:29 +00:00
2014-12-12 23:59:29 +00:00
2015-06-05 18:04:42 +00:00
2015-06-25 20:14:47 +00:00
2015-08-11 21:33:55 +00:00
2015-08-28 19:09:31 +00:00
2015-12-05 23:44:22 +00:00
2015-03-13 18:20:45 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-03-13 18:20:45 +00:00
2014-12-03 10:39:15 +00:00
2015-02-27 21:17:42 +00:00
2015-02-13 16:33:34 +00:00
2015-03-27 22:04:28 +00:00
2015-03-27 22:04:28 +00:00
2015-02-27 21:17:42 +00:00
2015-03-03 22:40:36 +00:00
2015-06-25 12:18:43 +00:00
2015-11-22 00:16:24 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2014-12-02 05:29:47 +00:00
2015-02-27 21:17:42 +00:00
2015-11-19 05:56:52 +00:00
2015-11-26 09:51:17 +00:00
2015-02-16 21:47:54 +00:00
2015-11-19 05:56:52 +00:00
2015-10-31 20:59:32 +00:00
2015-04-16 23:24:18 +00:00
2015-04-16 23:24:18 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 19:29:02 +00:00
2015-05-12 23:52:24 +00:00
2015-12-17 22:19:27 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-03-21 21:09:33 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-11-19 05:56:52 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-02-27 19:29:02 +00:00
2015-03-13 18:20:45 +00:00
2015-02-27 19:29:02 +00:00
2015-11-19 05:56:52 +00:00
2014-08-19 23:36:30 +00:00
2015-06-23 02:49:24 +00:00
2015-03-10 06:51:39 +00:00
2015-11-04 23:36:56 +00:00
2015-11-26 09:51:17 +00:00
2015-12-12 05:38:55 +00:00
2015-12-14 16:16:54 +00:00
2015-03-04 18:43:29 +00:00
2014-11-24 23:15:18 +00:00
2015-12-15 01:44:07 +00:00
2015-04-16 23:24:18 +00:00
2015-10-06 10:34:53 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-11-24 17:51:20 +00:00
2015-02-27 19:29:02 +00:00
2015-11-15 08:19:35 +00:00
2015-08-14 22:46:49 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 21:17:42 +00:00
2015-02-27 19:29:02 +00:00
2015-09-12 13:39:53 +00:00
2015-04-25 20:55:25 +00:00
2015-07-27 18:52:15 +00:00
2015-07-27 18:52:15 +00:00
2015-09-30 16:44:39 +00:00
2015-10-17 11:40:05 +00:00
2015-09-29 08:19:11 +00:00
2015-03-24 22:39:29 +00:00
2015-10-11 14:38:34 +00:00
2014-09-16 08:50:10 +00:00
2015-11-22 00:16:24 +00:00
2015-02-27 21:17:42 +00:00