issues with rtl vector operators

Devang Patel dpatel@apple.com
Wed Aug 18 19:17:00 GMT 2004


On Aug 9, 2004, at 5:56 PM, James E Wilson wrote:

> Now look at the altivec_vmrghw pattern in the rs6000/altivec.md file.
> The Altivec PEM says that given two inputs "ABCD" and "WXYZ" the result
> is "AWBX"  The altivec pattern is
> (vec_merge:V4SI
>   (vec_select:V4SI (match_operand...) [2 3 0 1])
>   (match_operand...)
>   (const_int 12))
> The vec_select rewrites the "ABCD" as "CDAB".  So we are then doing a
> vector merge of "CDAB" "WXYZ" 1100 which should be "CDYZ"

vector merge of "CDAB" "WXYZ" 1100 should be WXAB. But I still don't 
understand how it gets the right answer, that is "AWBX".

I tried following,
	#include <altivec.h>

	vector int a1 = { 100, 200, 300, 400};
	vector int a2 = { 500, 600, 700, 800};
	vector int k;

	int main()
	{
	  int i;
	  k = vec_mergeh (a1, a2);
	}

And it does the right thing, means k is assigned {100, 500, 200, 600}.

thoughts?
-
Devang

>  which has
> nothing in common with the result that the hardware delivers.  I don't
> know what the Altivec port is doing here.  I think it is just broken.



More information about the Gcc mailing list