Lines Matching refs:And
88 // Get the type really allocated and the type casted to.
145 // If the allocation has multiple real uses, insert a cast and change all
177 case Instruction::And:
232 /// simply extracts arguments and returns what that function returns.
264 /// generated and is interesting to optimize out.
269 // Noop casts and casts of constants should be eliminated trivially.
321 /// instead of its larger type, and arrive with the same value.
327 /// makes sense if x and y can be efficiently truncated.
329 /// This function works on both vectors and scalars.
357 case Instruction::And:
366 // UDiv and URem can be truncated if all the truncated bits are zero.
380 // If we are truncating the result of this SHL, and if it's a shift of a
434 /// right-shifted, and truncated, convert it to an extractelement.
514 // Canonicalize trunc x to i1 -> (icmp ne (and x, 1), 0), likewise for vector.
527 // the truncate (MidSize), and the destination of the truncate. We know that
528 // ASize < MidSize and MidSize > ResultSize, but don't know the relation
529 // between ASize and ResultSize.
537 // Since we're doing an lshr and a zero extend, and know that the shift
565 // Transform "trunc (and X, cst)" -> "and (trunc X), cst" so long as the dest
585 // If we are just checking for a icmp eq of a single bit and zext'ing it
586 // to an integer, then shift the bit to the appropriate place and then
621 // This only works for EQ and NE
663 // icmp ne A, B is equal to xor A, B when A and B only really have one bit.
685 // Mask off any bits that are set and won't be shifted away.
707 /// and produce the same low bits. If not, return false.
718 /// CanEvaluateZExtd for the 'lshr' will return true, and BitsToClear will be
720 /// cleared in addition to bits 32-63. Since an 'and' will be generated to
723 /// This function works on both vectors and scalars.
748 case Instruction::And:
761 // If the operation is an AND/OR/XOR and the bits to clear are zero in the
764 (Opc == Instruction::And || Opc == Instruction::Or ||
791 // ultimate 'and' to clear out the high zero bits we're clearing out though.
877 // We need to emit an AND to clear the high bits.
884 // types and if the sizes are just right we can convert this into a logical
885 // 'and' which will be much cheaper than the pair of casts.
890 // will be smaller than A or C, but don't know the relation between A and C.
902 Value *And = Builder->CreateAnd(A, AndConst, CSrc->getName()+".mask");
903 return new ZExtInst(And, CI.getType());
947 Value *And;
948 if (SrcI && match(SrcI, m_OneUse(m_Xor(m_Value(And), m_Constant(C)))) &&
949 match(And, m_OneUse(m_And(m_Trunc(m_Value(X)), m_Specific(C)))) &&
994 // If we know that only one bit of the LHS of the icmp can be set and we
996 // the icmp and sext into bitwise/integer operations.
1053 /// Return true if we can take the specified value and return it as type Ty
1054 /// without inserting any new casts and without changing the value of the common
1058 /// This function works on both vectors and scalars.
1083 case Instruction::And:
1187 // integers, we could turn this into a truncate to the smaller bit and then
1188 // use a sext for the whole extension. Since we don't, look deeper and check
1189 // for a truncate. If the source and dest are the same type, eliminate the
1190 // trunc and extend and just do shifts. For example, turn:
1240 // See if the value can be truncated to half and then reextended.
1243 // See if the value can be truncated to float and then reextended.
1264 // what we can and cannot do safely varies from operation to operation, and
1279 // For addition and subtraction, the infinitely precise result can
1287 // Specifically, if OpWidth >= 2*DstWdith+1 and DstWidth is sufficient
1376 // ruin min/max canonical form which is to have the select and
1437 // of the input range and output range.
1439 // This means this is also safe for a signed input and unsigned output, since
1519 // If CI is an addrspacecast and GEP changes the poiner type, merging
1557 /// Try to replace it with a shuffle (and vector/vector bitcast) if possible.
1559 /// The source and destination vector types may have different element types.
1580 // Now that the element types match, get the shuffle mask and RHS of the
1588 // elements from the input and use undef as the second shuffle input.
1595 // elements from InVal and fill the rest of the result elements with zeros
1625 /// Shift is the number of bits between the lsb of V and the lsb of
1660 // Figure out the # elements this provides, and bitcast it or slice it up
1671 // pieces and insert each element-sized piece into the vector.
1725 /// If the input is an 'or' instruction, we may be doing shifts and ors to
1727 /// Try to rip the code out and replace it with insertelements. This is to
1771 // TODO: Create and use a pattern matcher for ExtractElementInst.
1796 // Get rid of casts from one type to the same type. These are useless and can
1814 // If the source and destination are pointers, and this cast is equivalent
1816 // This can enhance SROA and other transforms that want type-safe pointers.
1843 // the casts with a shuffle and (potentially) a bitcast.
1853 // If the input is an 'or' instruction, we may be doing shifts and ors to
1855 // and replace it with insertelements.
1915 // first do a bitcast to the destination type, and then the addrspacecast.