Andrea Di Biagio
54529ed1c4
[X86] Avoid introducing extra shuffles when lowering packed vector shifts.
...
When lowering a vector shift node, the backend checks if the shift count is a
shuffle with a splat mask. If so, then it introduces an extra dag node to
extract the splat value from the shuffle. The splat value is then used
to generate a shift count of a target specific shift.
However, if we know that the shift count is a splat shuffle, we can use the
splat index 'I' to extract the I-th element from the first shuffle operand.
The advantage is that the splat shuffle may become dead since we no longer
use it.
Example:
;;
define <4 x i32> @example(<4 x i32> %a, <4 x i32> %b) {
%c = shufflevector <4 x i32> %b, <4 x i32> undef, <4 x i32> zeroinitializer
%shl = shl <4 x i32> %a, %c
ret <4 x i32> %shl
}
;;
Before this patch, llc generated the following code (-mattr=+avx):
vpshufd $0, %xmm1, %xmm1 # xmm1 = xmm1[0,0,0,0]
vpxor %xmm2, %xmm2
vpblendw $3, %xmm1, %xmm2, %xmm1 # xmm1 = xmm1[0,1],xmm2[2,3,4,5,6,7]
vpslld %xmm1, %xmm0, %xmm0
retq
With this patch, the redundant splat operation is removed from the code.
vpxor %xmm2, %xmm2
vpblendw $3, %xmm1, %xmm2, %xmm1 # xmm1 = xmm1[0,1],xmm2[2,3,4,5,6,7]
vpslld %xmm1, %xmm0, %xmm0
retq
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223461 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 12:13:30 +00:00
..
2014-10-03 20:01:09 +00:00
2014-11-11 02:23:47 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-21 01:17:30 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-04 03:52:55 +00:00
2014-10-01 03:19:43 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-12-01 17:36:43 +00:00
2014-10-03 20:00:34 +00:00
2014-10-16 20:00:02 +00:00
2014-12-01 17:36:43 +00:00
2014-10-08 23:16:23 +00:00
2014-09-25 17:27:43 +00:00
2014-10-08 19:38:18 +00:00
2014-09-23 20:59:25 +00:00
2014-11-06 22:15:41 +00:00
2014-10-14 22:31:34 +00:00
2014-10-04 03:52:55 +00:00
2014-10-28 12:28:51 +00:00
2014-10-05 11:41:36 +00:00
2014-11-13 11:46:16 +00:00
2014-10-15 23:42:17 +00:00
2014-11-25 20:41:51 +00:00
2014-11-01 03:19:45 +00:00
2014-10-05 14:11:08 +00:00
2014-10-28 12:28:51 +00:00
2014-10-28 12:28:51 +00:00
2014-10-08 15:49:26 +00:00
2014-09-26 09:48:50 +00:00
2014-10-08 15:49:26 +00:00
2014-09-26 09:48:50 +00:00
2014-11-26 10:46:49 +00:00
2014-10-08 15:49:26 +00:00
2014-09-26 09:48:50 +00:00
2014-10-04 03:52:55 +00:00
2014-11-18 23:38:19 +00:00
2014-10-14 22:31:34 +00:00
2014-10-04 03:52:55 +00:00
2014-11-21 13:56:05 +00:00
2014-09-30 02:52:28 +00:00
2014-10-23 17:50:42 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-10-23 22:31:48 +00:00
2014-11-13 01:44:51 +00:00
2014-09-19 01:14:56 +00:00
2014-09-20 21:18:43 +00:00
2014-12-02 22:31:23 +00:00
2014-12-02 22:31:23 +00:00
2014-11-04 23:25:08 +00:00
2014-11-04 23:25:08 +00:00
2014-11-06 14:36:45 +00:00
2014-12-03 23:38:08 +00:00
2014-10-03 20:01:09 +00:00
2014-10-03 20:01:09 +00:00
2014-11-03 20:26:35 +00:00
2014-10-16 20:00:02 +00:00
2014-10-16 20:00:02 +00:00
2014-10-03 20:01:09 +00:00
2014-10-17 22:59:33 +00:00
2014-10-04 03:52:55 +00:00
2014-10-24 21:04:41 +00:00
2014-10-12 06:47:47 +00:00
2014-11-05 20:02:05 +00:00
2014-11-05 19:27:21 +00:00
2014-11-03 18:19:26 +00:00
2014-11-06 21:46:23 +00:00
2014-11-05 06:43:02 +00:00
2014-11-06 21:58:11 +00:00
2014-11-17 16:17:51 +00:00
2014-10-21 23:01:01 +00:00
2014-10-21 23:01:01 +00:00
2014-10-01 21:20:06 +00:00
2014-10-20 22:14:22 +00:00
2014-10-04 03:52:55 +00:00
2014-10-04 03:52:55 +00:00
2014-10-03 20:01:09 +00:00
2014-12-04 13:49:51 +00:00
2014-11-14 00:35:50 +00:00
2014-12-01 21:04:44 +00:00
2014-12-01 21:04:44 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-11-11 21:08:02 +00:00
2014-10-15 03:27:43 +00:00
2014-12-05 12:13:30 +00:00
2014-10-03 20:01:09 +00:00
2014-12-04 09:40:44 +00:00
2014-10-10 17:06:20 +00:00
2014-10-03 01:06:32 +00:00
2014-10-23 17:50:42 +00:00
2014-10-16 20:00:02 +00:00
2014-11-04 13:41:33 +00:00
2014-11-04 13:41:33 +00:00
2014-10-17 17:27:06 +00:00
2014-10-03 20:01:09 +00:00
2014-11-06 05:01:21 +00:00
2014-11-19 10:06:49 +00:00
2014-10-21 01:17:30 +00:00
2014-10-02 22:21:49 +00:00
2014-10-02 22:21:49 +00:00
2014-10-04 03:52:55 +00:00
2014-10-04 03:52:55 +00:00
2014-10-03 01:06:32 +00:00
2014-11-18 23:38:19 +00:00
2014-10-07 23:53:57 +00:00
2014-11-11 20:49:16 +00:00
2014-12-03 02:08:38 +00:00
2014-12-03 02:08:38 +00:00
2014-09-22 18:07:20 +00:00
2014-12-04 10:36:42 +00:00
2014-10-10 17:06:20 +00:00
2014-11-12 21:39:01 +00:00
2014-09-22 13:11:35 +00:00
2014-09-22 13:11:35 +00:00
2014-10-06 20:19:47 +00:00
2014-12-01 21:04:44 +00:00
2014-10-05 22:57:31 +00:00
2014-09-25 23:14:26 +00:00
2014-10-15 03:27:43 +00:00
2014-12-04 00:56:38 +00:00
2014-11-21 11:19:34 +00:00
2014-11-17 16:17:51 +00:00
2014-11-28 18:40:18 +00:00
2014-09-22 18:54:01 +00:00
2014-10-24 17:59:18 +00:00
2014-10-04 03:52:55 +00:00
2014-10-14 22:31:34 +00:00
2014-11-19 19:34:29 +00:00
2014-11-19 10:06:49 +00:00
2014-12-02 22:31:23 +00:00
2014-10-04 03:52:55 +00:00
2014-11-05 06:43:02 +00:00
2014-10-04 03:52:55 +00:00
2014-10-03 20:01:09 +00:00
2014-12-01 04:27:03 +00:00
2014-10-03 20:01:09 +00:00
2014-10-02 22:21:49 +00:00
2014-11-04 17:11:00 +00:00
2014-10-02 22:21:49 +00:00
2014-10-02 22:21:49 +00:00
2014-10-27 22:38:45 +00:00
2014-10-02 22:21:49 +00:00
2014-12-02 18:50:36 +00:00
2014-12-02 18:50:36 +00:00
2014-12-02 18:50:36 +00:00
2014-11-29 21:17:05 +00:00
2014-10-04 03:52:55 +00:00
2014-12-01 21:04:44 +00:00
2014-11-11 18:44:49 +00:00
2014-10-04 03:52:55 +00:00
2014-11-17 08:00:45 +00:00
2014-10-04 03:52:55 +00:00
2014-11-21 17:40:04 +00:00
2014-10-03 20:01:09 +00:00
2014-10-05 22:57:31 +00:00
2014-11-13 02:42:08 +00:00
2014-10-04 03:52:55 +00:00
2014-10-04 04:22:55 +00:00
2014-11-19 10:06:49 +00:00
2014-10-04 03:52:55 +00:00
2014-11-05 06:43:02 +00:00
2014-11-21 00:47:19 +00:00
2014-11-24 12:23:15 +00:00
2014-10-04 03:52:55 +00:00
2014-10-04 03:52:55 +00:00
2014-11-25 22:34:59 +00:00
2014-12-02 22:31:23 +00:00
2014-11-25 22:34:59 +00:00
2014-11-19 10:06:49 +00:00
2014-11-22 05:44:43 +00:00
2014-11-21 14:33:24 +00:00
2014-11-22 05:44:43 +00:00
2014-11-22 05:44:43 +00:00
2014-11-21 14:53:03 +00:00
2014-11-21 13:56:05 +00:00
2014-10-03 11:25:58 +00:00
2014-11-12 10:05:18 +00:00
2014-10-28 01:29:26 +00:00
2014-11-24 12:23:15 +00:00
2014-11-06 02:25:03 +00:00
2014-11-05 06:43:02 +00:00
2014-12-05 12:13:30 +00:00
2014-09-19 20:00:32 +00:00
2014-10-04 03:52:55 +00:00
2014-11-06 14:39:49 +00:00
2014-11-20 18:01:26 +00:00
2014-10-23 21:55:31 +00:00