Index: lib/Analysis/ValueTracking.cpp =================================================================== --- lib/Analysis/ValueTracking.cpp +++ lib/Analysis/ValueTracking.cpp @@ -2523,9 +2523,7 @@ case LibFunc::sqrt: case LibFunc::sqrtf: case LibFunc::sqrtl: - if (ICS->hasNoNaNs()) - return Intrinsic::sqrt; - return Intrinsic::not_intrinsic; + return Intrinsic::sqrt; } return Intrinsic::not_intrinsic; Index: test/CodeGen/X86/lit.local.cfg =================================================================== --- test/CodeGen/X86/lit.local.cfg +++ test/CodeGen/X86/lit.local.cfg @@ -4,7 +4,7 @@ # # It should be possible to remove this override once all the bots have cycled # cleanly. -config.suffixes = ['.ll', '.mir', '.test', '.txt'] +config.suffixes = ['.ll', '.c', '.mir', '.test', '.txt'] if not 'X86' in config.root.targets: config.unsupported = True Index: test/CodeGen/X86/vector-sqrt.c =================================================================== --- test/CodeGen/X86/vector-sqrt.c +++ test/CodeGen/X86/vector-sqrt.c @@ -0,0 +1,19 @@ +// RUN: clang %s -march=haswell -O3 -S -o - | FileCheck %s + +#include + +// CHECK-LABEL: sqrtd +// CHECK: vsqrtpd (%rdi), %xmm0 +// CHECK-NEXT: retq + +__m128d sqrtd2(double* v) { + return _mm_setr_pd(__builtin_sqrt(v[0]), __builtin_sqrt(v[1])); +} + +// CHECK-LABEL: sqrtf4 +// CHECK: vsqrtps (%rdi), %xmm0 +// CHECK-NEXT: retq + +__m128 sqrtf4(float* v) { + return _mm_setr_ps(__builtin_sqrtf(v[0]), __builtin_sqrtf(v[1]), __builtin_sqrtf(v[2]), __builtin_sqrtf(v[3])); +}