[PATCH] D54728: Implement computeKnownBits for scalar_to_vector

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 15:37:07 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347274: Implement computeKnownBits for scalar_to_vector (authored by rampitec, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54728?vs=174685&id=174701#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54728

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/trunk/test/CodeGen/AMDGPU/load-lo16.ll


Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2345,6 +2345,19 @@
     }
     break;
   }
+  case ISD::SCALAR_TO_VECTOR: {
+    // We know about scalar_to_vector as much as we know about it source,
+    // which becomes the first element of otherwise unknown vector.
+    if (DemandedElts != 1)
+      break;
+
+    SDValue N0 = Op.getOperand(0);
+    Known = computeKnownBits(N0, DemandedElts, Depth + 1);
+    if (N0.getValueSizeInBits() != BitWidth)
+      Known = Known.trunc(BitWidth);
+
+    break;
+  }
   case ISD::BITCAST: {
     SDValue N0 = Op.getOperand(0);
     EVT SubVT = N0.getValueType();
Index: llvm/trunk/test/CodeGen/AMDGPU/load-lo16.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/load-lo16.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/load-lo16.ll
@@ -305,8 +305,11 @@
 ; GFX9-NEXT: s_waitcnt
 ; GFX9-NEXT: s_setpc_b64
 
-; VI: flat_load_ubyte v{{[0-9]+}}
-; VI: v_or_b32_e32
+; VI: flat_load_ubyte [[LO:v[0-9]+]]
+; VI: v_lshrrev_b32_e32 [[HI:v[0-9]+]], 16, v2
+; VI: s_mov_b32 [[MASK:s[0-9]+]], 0x5040c00
+; VI: v_perm_b32 [[RES:v[0-9]+]], [[HI]], [[LO]], [[MASK]]
+; VI: flat_store_dword v[0:1], [[RES]]
 define void @load_flat_lo_v2i16_reglo_vreg_zexti8(i8* %in, i32 %reg) #0 {
 entry:
   %reg.bc = bitcast i32 %reg to <2 x i16>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54728.174701.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/3db0e387/attachment.bin>


More information about the llvm-commits mailing list