From 749691ca2ad79eda60a66527aac0aab0d6ed0a0f Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 4 Oct 2019 11:50:11 -0700 Subject: [PATCH] Add a comment explaining why we don't use the intrinsics for these. --- lib/llvm-backend/src/code.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index a1c69c08262..13dcd2bd9b3 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -2692,6 +2692,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(bits); } Operator::F32Min => { + // This implements the same logic as LLVM's @llvm.minimum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = canonicalize_nans(builder, intrinsics, v1); let v2 = canonicalize_nans(builder, intrinsics, v2); @@ -2735,6 +2738,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F64Min => { + // This implements the same logic as LLVM's @llvm.minimum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = canonicalize_nans(builder, intrinsics, v1); let v2 = canonicalize_nans(builder, intrinsics, v2); @@ -2778,6 +2784,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F32x4Min => { + // This implements the same logic as LLVM's @llvm.minimum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = builder.build_bitcast(v1, intrinsics.f32x4_ty, ""); let v2 = builder.build_bitcast(v2, intrinsics.f32x4_ty, ""); @@ -2830,6 +2839,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F64x2Min => { + // This implements the same logic as LLVM's @llvm.minimum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = builder.build_bitcast(v1, intrinsics.f64x2_ty, ""); let v2 = builder.build_bitcast(v2, intrinsics.f64x2_ty, ""); @@ -2882,6 +2894,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F32Max => { + // This implements the same logic as LLVM's @llvm.maximum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = canonicalize_nans(builder, intrinsics, v1); let v2 = canonicalize_nans(builder, intrinsics, v2); @@ -2924,6 +2939,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F64Max => { + // This implements the same logic as LLVM's @llvm.maximum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = canonicalize_nans(builder, intrinsics, v1); let v2 = canonicalize_nans(builder, intrinsics, v2); @@ -2966,6 +2984,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F32x4Max => { + // This implements the same logic as LLVM's @llvm.maximum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = builder.build_bitcast(v1, intrinsics.f32x4_ty, ""); let v2 = builder.build_bitcast(v2, intrinsics.f32x4_ty, ""); @@ -3018,6 +3039,9 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { state.push1(res); } Operator::F64x2Max => { + // This implements the same logic as LLVM's @llvm.maximum + // intrinsic would, but x86 lowering of that intrinsics + // encounters a fatal error in LLVM 8 and LLVM 9. let (v1, v2) = state.pop2()?; let v1 = builder.build_bitcast(v1, intrinsics.f64x2_ty, ""); let v2 = builder.build_bitcast(v2, intrinsics.f64x2_ty, "");