[PATCH] D18929: [Clang][AVX512][BuiltIn] Adding avx512 ( punpck{h|l}{dq|qdq}{128|256|512}, rndscale{ss|sd}, {scalef{ss|sd|pd512|ps512} ) builtin to clang ....

michael zuckerman via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 10 00:46:04 PDT 2016


m_zuckerman added inline comments.

================
Comment at: test/CodeGen/avx512f-builtins.c:2660
@@ +2659,3 @@
+  // CHECK: @llvm.x86.avx512.mask.rndscale.sd
+  return _mm_roundscale_sd(__A, __B, 4); 
+}
----------------
delena wrote:
> use "CURRENT", please
This is not a regular round mode. 

RoundTo_IntegerPD(src[63:0], imm8[7:0]){
	IF(imm8[2] == 1)
		rounding_direction := MXCSR.RC //Use the rounding mode specified by MXCSR.RC
	ELSE
		rounding_direction := imm8[1:0] //Use the rounding mode specified by imm8[1:0]
	FI
	
	M := imm8[7:4] // The scaling factor (number of fraction bits to round to)
	
	CASE(rounding_direction)
	0: tmp[63:0] := round_to_nearest_even_integer(2^M * src[63:0])
	1: tmp[63:0] := round_to_equal_or_smaller_integer(2^M * src[63:0])
	2: tmp[63:0] := round_to_equal_or_larger_integer(2^M * src[63:0])
	3: tmp[63:0] := round_to_nearest_smallest_magnitude_integer(2^M * src[63:0])
	ESAC
	
	dst[63:0] := 2^-M * tmp[63:0] // scale back down
	
	IF imm8[3] == 0 //check SPE
		IF src[63:0] != dst[63:0] //check if precision has been lost
			set_precision() //set #PE
		FI
	FI
	RETURN dst[63:0]
}		

dst[63:0] := RoundTo_IntegerPD(a[63:0], imm8[7:0])
dst[127:64] := b[127:64]
dst[MAX:128] := 0

================
Comment at: test/CodeGen/avx512f-builtins.c:2665
@@ +2664,3 @@
+  // CHECK: @llvm.x86.avx512.mask.rndscale.sd
+    return _mm_mask_roundscale_sd(__W,__U,__A,__B,3);
+}
----------------
delena wrote:
> Why 3?
Like up 


http://reviews.llvm.org/D18929





More information about the llvm-commits mailing list