/* Goal functions for the vector superoptimizer. Copyright 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* evaluate in a degree-3 poynomial in the 2 non-trivial points -1, 1. Input in v[0..2]. (Used for toom32/A) */ DEF(3,2,goal_32, { gv[0] = v[0] - v[1] + v[2]; /* -1 */ gv[1] = v[0] + v[1] + v[2]; /* +1 */ }) /* evaluate in a degree-3 poynomial in the 3 non-trivial points -1, 1, 2. Input in v[0..2]. (Used for toom33/AB) */ DEF(3,3,goal_33, { gv[0] = v[0] - v[1] + v[2]; /* -1 */ gv[1] = v[0] + v[1] + v[2]; /* +1 */ gv[2] = v[0] + 2*v[1] + 4*v[2]; /* +2 */ }) /* evaluate in a degree-4 poynomial in the 3 non-trivial points -1, 1, 2. Input in v[0..3]. (Used for toom42/A) */ DEF(4,3,goal_43, { gv[0] = v[0] - v[1] + v[2] - v[3]; /* -1 */ gv[1] = v[0] + v[1] + v[2] + v[3]; /* +1 */ gv[2] = v[0] + 2*v[1] + 4*v[2] + 8*v[3]; /* +2 */ }) /* evaluate in a degree-3 poynomial in the 4 non-trivial points -2, -1, 1, 2. Input in v[0..2]. (Used for toom43/B) */ DEF(3,4,goal_34, { gv[0] = v[0] - 2*v[1] + 4*v[2]; /* -2 */ gv[1] = v[0] - v[1] + v[2]; /* -1 */ gv[2] = v[0] + v[1] + v[2]; /* +1 */ gv[3] = v[0] + 2*v[1] + 4*v[2]; /* +2 */ }) /* evaluate in a degree-4 poynomial in the 4 non-trivial points -2, -1, 1, 2. Input in v[0..3]. (Used for toom43/A) */ DEF(4,4,goal_44, { gv[0] = v[0] - 2*v[1] + 4*v[2] - 8*v[3]; /* -2 */ gv[1] = v[0] - v[1] + v[2] - v[3]; /* -1 */ gv[2] = v[0] + v[1] + v[2] + v[3]; /* +1 */ gv[3] = v[0] + 2*v[1] + 4*v[2] + 8*v[3]; /* +2 */ }) /* evaluate in a degree-5 poynomial in the 4 non-trivial points -2, -1, 1, 2. Input in v[0..4]. (Used for toom52/A) */ DEF(5,4,goal_54, { gv[0] = v[0] - 2*v[1] + 4*v[2] - 8*v[3] + 16*v[4]; /* -2 */ gv[1] = v[0] - v[1] + v[2] - v[3] + v[4]; /* -1 */ gv[2] = v[0] + v[1] + v[2] + v[3] + v[4]; /* +1 */ gv[3] = v[0] + 2*v[1] + 4*v[2] + 8*v[3] + 16*v[4]; /* +2 */ }) /* evaluate in a degree-3 poynomial in the 5 non-trivial points -1, -1/2, 1, 1/2, 2. Input in v[0..2]. (Used for toom53/B) */ DEF(3,5,goal_35, { gv[0] = v[0] - v[1] + v[2]; /* -1 */ gv[1] = 4*v[0] - 2*v[1] + v[2]; /* -1/2 */ gv[2] = v[0] + v[1] + v[2]; /* +1 */ gv[3] = 4*v[0] + 2*v[1] + v[2]; /* +1/2 */ gv[4] = v[0] + 2*v[1] + 4*v[2]; /* +2 */ }) /* evaluate in a degree-4 poynomial in the 5 non-trivial points -1, -1/2, 1, 1/2, 2. Input in v[0..3]. (Used for toom44/AB) */ DEF(4,5,goal_45, { gv[0] = v[0] - v[1] + v[2] - v[3]; /* -1 */ gv[1] = 8*v[0] - 4*v[1] + 2*v[2] - v[3]; /* -1/2 */ gv[2] = v[0] + v[1] + v[2] + v[3]; /* +1 */ gv[3] = 8*v[0] + 4*v[1] + 2*v[2] + v[3]; /* +1/2 */ gv[4] = v[0] + 2*v[1] + 4*v[2] + 8*v[3]; /* +2 */ }) /* evaluate in a degree-5 poynomial in the 5 non-trivial points -1, -1/2, 1, 1/2, 2. Input in v[0..4]. (Used for toom53/A) */ DEF(5,5,goal_55, { gv[0] = v[0] - v[1] + v[2] - v[3] + v[4]; /* -1 */ gv[1] = 16*v[0] - 8*v[1] + 4*v[2] - 2*v[3] + v[4]; /* -1/2 */ gv[2] = v[0] + v[1] + v[2] + v[3] + v[4]; /* +1 */ gv[3] = 16*v[0] + 8*v[1] + 4*v[2] + 2*v[3] + v[4]; /* +1/2 */ gv[4] = v[0] + 2*v[1] + 4*v[2] + 8*v[3] + 16*v[4]; /* +2 */ }) /* evaluate in a degree-6 poynomial in the 5 non-trivial points -1, -1/2, 1, 1/2, 2. Input in v[0..5]. (Used for toom53/A) */ DEF(6,5,goal_65, { gv[0] = v[0] - v[1] + v[2] - v[3] + v[4] - v[5]; /* -1 */ gv[1] = 32*v[0] - 16*v[1] + 8*v[2] - 4*v[3] + 2*v[4] - v[5]; /* -1/2 */ gv[2] = v[0] + v[1] + v[2] + v[3] + v[4] + v[5]; /* +1 */ gv[3] = 32*v[0] + 16*v[1] + 8*v[2] + 4*v[3] + 2*v[4] + v[5]; /* +1/2 */ gv[4] = v[0] + 2*v[1] + 4*v[2] + 8*v[3] + 16*v[4] + 32*v[5]; /* +2 */ }) /* Trivial test function */ DEF(2,2,goal_test_22, { gv[1] = v[0] + v[1]; gv[0] = v[0] - 2 * v[1]; }) /* Trivial test function */ DEF(2,3,goal_test_23, { gv[0] = v[0] + v[1]; gv[1] = v[0] - v[1]; gv[2] = v[1] - v[0]; })