This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by m_zuckerman on Apr 9 2016, 8:16 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

m_zuckerman updated this revision to Diff 53131.Apr 9 2016, 8:16 AM
m_zuckerman retitled this revision from to [Clang][AVX512][BuiltIn] Adding avx512 ( punpck{h|l}{dq|qdq}{128|256|512},rndscale{ss|sd}, {scalef{ss|sd|pd512|ps512} ) builtin to clang .....
m_zuckerman updated this object.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: llvm-commits.
delena edited edge metadata.Apr 9 2016, 10:09 AM

Please add tests with non-default round mode.

test/CodeGen/avx512f-builtins.c
2660 ↗(On Diff #53131)

use "CURRENT", please

2665 ↗(On Diff #53131)

Why 3?

2695 ↗(On Diff #53131)

???

m_zuckerman added inline comments.Apr 10 2016, 12:46 AM
test/CodeGen/avx512f-builtins.c
2660 ↗(On Diff #53131)

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

2665 ↗(On Diff #53131)

Like up

m_zuckerman edited edge metadata.
m_zuckerman marked 2 inline comments as done.Apr 11 2016, 3:37 AM

Ping

delena accepted this revision.Apr 11 2016, 3:49 AM
delena edited edge metadata.
This revision is now accepted and ready to land.Apr 11 2016, 3:49 AM
This revision was automatically updated to reflect the committed changes.