OLD | NEW |
1 //===- InstCombineSimplifyDemanded.cpp ------------------------------------===// | 1 //===- InstCombineSimplifyDemanded.cpp ------------------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file contains logic for simplifying instructions based on information | 10 // This file contains logic for simplifying instructions based on information |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 else | 773 else |
774 NewVal = BinaryOperator::CreateShl(II->getArgOperand(0), | 774 NewVal = BinaryOperator::CreateShl(II->getArgOperand(0), |
775 ConstantInt::get(I->getType(), ResultBit-InputBit)); | 775 ConstantInt::get(I->getType(), ResultBit-InputBit)); |
776 NewVal->takeName(I); | 776 NewVal->takeName(I); |
777 return InsertNewInstWith(NewVal, *I); | 777 return InsertNewInstWith(NewVal, *I); |
778 } | 778 } |
779 | 779 |
780 // TODO: Could compute known zero/one bits based on the input. | 780 // TODO: Could compute known zero/one bits based on the input. |
781 break; | 781 break; |
782 } | 782 } |
| 783 #if defined(TARGET_ENABLED_X86) |
783 case Intrinsic::x86_sse42_crc32_64_8: | 784 case Intrinsic::x86_sse42_crc32_64_8: |
784 case Intrinsic::x86_sse42_crc32_64_64: | 785 case Intrinsic::x86_sse42_crc32_64_64: |
785 KnownZero = APInt::getHighBitsSet(64, 32); | 786 KnownZero = APInt::getHighBitsSet(64, 32); |
786 return 0; | 787 return 0; |
| 788 #endif // TARGET_ENABLED_X86 |
787 } | 789 } |
788 } | 790 } |
789 ComputeMaskedBits(V, DemandedMask, KnownZero, KnownOne, Depth); | 791 ComputeMaskedBits(V, DemandedMask, KnownZero, KnownOne, Depth); |
790 break; | 792 break; |
791 } | 793 } |
792 | 794 |
793 // If the client is only demanding bits that we know, return the known | 795 // If the client is only demanding bits that we know, return the known |
794 // constant. | 796 // constant. |
795 if ((DemandedMask & (KnownZero|KnownOne)) == DemandedMask) | 797 if ((DemandedMask & (KnownZero|KnownOne)) == DemandedMask) |
796 return Constant::getIntegerValue(VTy, KnownOne); | 798 return Constant::getIntegerValue(VTy, KnownOne); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 break; | 1079 break; |
1078 | 1080 |
1079 case Instruction::Call: { | 1081 case Instruction::Call: { |
1080 IntrinsicInst *II = dyn_cast<IntrinsicInst>(I); | 1082 IntrinsicInst *II = dyn_cast<IntrinsicInst>(I); |
1081 if (!II) break; | 1083 if (!II) break; |
1082 switch (II->getIntrinsicID()) { | 1084 switch (II->getIntrinsicID()) { |
1083 default: break; | 1085 default: break; |
1084 | 1086 |
1085 // Binary vector operations that work column-wise. A dest element is a | 1087 // Binary vector operations that work column-wise. A dest element is a |
1086 // function of the corresponding input elements from the two inputs. | 1088 // function of the corresponding input elements from the two inputs. |
| 1089 #if defined(TARGET_ENABLED_X86) |
1087 case Intrinsic::x86_sse_sub_ss: | 1090 case Intrinsic::x86_sse_sub_ss: |
1088 case Intrinsic::x86_sse_mul_ss: | 1091 case Intrinsic::x86_sse_mul_ss: |
1089 case Intrinsic::x86_sse_min_ss: | 1092 case Intrinsic::x86_sse_min_ss: |
1090 case Intrinsic::x86_sse_max_ss: | 1093 case Intrinsic::x86_sse_max_ss: |
1091 case Intrinsic::x86_sse2_sub_sd: | 1094 case Intrinsic::x86_sse2_sub_sd: |
1092 case Intrinsic::x86_sse2_mul_sd: | 1095 case Intrinsic::x86_sse2_mul_sd: |
1093 case Intrinsic::x86_sse2_min_sd: | 1096 case Intrinsic::x86_sse2_min_sd: |
1094 case Intrinsic::x86_sse2_max_sd: | 1097 case Intrinsic::x86_sse2_max_sd: |
1095 TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts, | 1098 TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts, |
1096 UndefElts, Depth+1); | 1099 UndefElts, Depth+1); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 II->getName()); | 1141 II->getName()); |
1139 InsertNewInstWith(New, *II); | 1142 InsertNewInstWith(New, *II); |
1140 return New; | 1143 return New; |
1141 } | 1144 } |
1142 } | 1145 } |
1143 | 1146 |
1144 // Output elements are undefined if both are undefined. Consider things | 1147 // Output elements are undefined if both are undefined. Consider things |
1145 // like undef&0. The result is known zero, not undef. | 1148 // like undef&0. The result is known zero, not undef. |
1146 UndefElts &= UndefElts2; | 1149 UndefElts &= UndefElts2; |
1147 break; | 1150 break; |
| 1151 #endif // TARGET_ENABLED_X86 |
1148 } | 1152 } |
1149 break; | 1153 break; |
1150 } | 1154 } |
1151 } | 1155 } |
1152 return MadeChange ? I : 0; | 1156 return MadeChange ? I : 0; |
1153 } | 1157 } |
OLD | NEW |