103b705cfSriastradh/*
203b705cfSriastradh * Copyright (c) 2011 Intel Corporation
303b705cfSriastradh *
403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a
503b705cfSriastradh * copy of this software and associated documentation files (the "Software"),
603b705cfSriastradh * to deal in the Software without restriction, including without limitation
703b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the
903b705cfSriastradh * Software is furnished to do so, subject to the following conditions:
1003b705cfSriastradh *
1103b705cfSriastradh * The above copyright notice and this permission notice (including the next
1203b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the
1303b705cfSriastradh * Software.
1403b705cfSriastradh *
1503b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1603b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1703b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1803b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1903b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2003b705cfSriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2103b705cfSriastradh * SOFTWARE.
2203b705cfSriastradh *
2303b705cfSriastradh * Authors:
2403b705cfSriastradh *    Chris Wilson <chris@chris-wilson.co.uk>
2503b705cfSriastradh *
2603b705cfSriastradh */
2703b705cfSriastradh
2803b705cfSriastradh#include "brw_test.h"
2903b705cfSriastradh#include <string.h>
3003b705cfSriastradh
3103b705cfSriastradhvoid brw_test_compare(const char *function, int gen,
3203b705cfSriastradh		      const struct brw_instruction *new, int num_new,
3303b705cfSriastradh		      const struct brw_instruction *old, int num_old)
3403b705cfSriastradh{
3503b705cfSriastradh	int n;
3603b705cfSriastradh
3703b705cfSriastradh	if (num_new != num_old ||
3803b705cfSriastradh	    memcmp(new, old, num_new * sizeof(struct brw_instruction))) {
3903b705cfSriastradh		printf ("%s: new\n", function);
4003b705cfSriastradh		for (n = 0; n < num_new; n++)
4103b705cfSriastradh			brw_disasm(stdout, &new[n], gen);
4203b705cfSriastradh
4303b705cfSriastradh		printf ("%s: old\n", function);
4403b705cfSriastradh		for (n = 0; n < num_old; n++)
4503b705cfSriastradh			brw_disasm(stdout, &old[n], gen);
4603b705cfSriastradh		printf ("\n");
4703b705cfSriastradh	}
4803b705cfSriastradh}
4903b705cfSriastradh
5003b705cfSriastradh
5103b705cfSriastradh/* Check that we can recreate all the existing programs using the assembler */
5203b705cfSriastradhint main(int argc, char **argv)
5303b705cfSriastradh{
5403b705cfSriastradh	brw_test_gen4();
5503b705cfSriastradh	brw_test_gen5();
5603b705cfSriastradh	brw_test_gen6();
5703b705cfSriastradh	brw_test_gen7();
5803b705cfSriastradh
5903b705cfSriastradh	return 0;
6003b705cfSriastradh}
61