Simplify hps build and driver codes

Simplify hps build and driver codes for better expandability.

This CL is part one of
https://spacebeaker-review.git.corp.google.com/c/shodan/ml-models-public/+/32934.
, which will be splitted into two parts for better readability and
clarity.

Change-Id: I1f8359955a862ef00d7e658a3596fe8fc1bf263f
diff --git a/quant_models/CMakeLists.txt b/quant_models/CMakeLists.txt
index 88e9b3c..ce09148 100644
--- a/quant_models/CMakeLists.txt
+++ b/quant_models/CMakeLists.txt
@@ -62,7 +62,7 @@
 # Binaries to execute the IREE model input
 # ------------------------------------------------------------------------------
 
-foreach(N 0 1 2 3 4 5 6)
+foreach(N RANGE 0 6)
   iree_model_input(
     NAME
       hps_${N}_quant_input
@@ -108,8 +108,9 @@
 #
 # to increase it.
 
-foreach(N 0 1 2 3 4 5 6)
-  set(HPS_COPTS "-DHPS_IDX=${N}")
+foreach(N RANGE 0 6)
+  set(HPS_COPTS "-DHPS_QUANT_INPUT=hps_${N}_quant_input")
+  list(APPEND HPS_COPTS "-DHPS_QUANT_INPUT_C_H=\"hps_${N}_quant_input_c.h\"")
   if (NOT BUILD_NO_WMMU)
     list(APPEND HPS_COPTS "-DNO_STATIC_INPUT")
   endif()
diff --git a/quant_models/iree_exec/hps.c b/quant_models/iree_exec/hps.c
index 0ebb91c..68cd767 100644
--- a/quant_models/iree_exec/hps.c
+++ b/quant_models/iree_exec/hps.c
@@ -21,28 +21,7 @@
 #include <springbok.h>
 
 #if !defined(NO_STATIC_INPUT)
-#if HPS_IDX == 0
-#include "hps_0_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_0_quant_input
-#elif HPS_IDX == 2
-#include "hps_2_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_2_quant_input
-#elif HPS_IDX == 3
-#include "hps_3_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_3_quant_input
-#elif HPS_IDX == 4
-#include "hps_4_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_4_quant_input
-#elif HPS_IDX == 5
-#include "hps_5_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_5_quant_input
-#elif HPS_IDX == 6
-#include "hps_6_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_6_quant_input
-#else
-#include "hps_1_quant_input_c.h"
-#define HPS_QUANT_INPUT hps_1_quant_input
-#endif
+#include HPS_QUANT_INPUT_C_H
 static const void *kInput = HPS_QUANT_INPUT;
 #else
 static const void *kInput = (const void *)0x84000000;
diff --git a/quant_models/iree_exec/hps_test.run b/quant_models/iree_exec/hps_test.run
index 7565300..60d268d 100644
--- a/quant_models/iree_exec/hps_test.run
+++ b/quant_models/iree_exec/hps_test.run
@@ -11,7 +11,7 @@
 // RUN: cat %t | FileCheck %S/hps_1_test.filecheck
 
 // RUN: ${TEST_RUNNER_CMD} %S/hps_2_emitc_static 2>&1 | tee %t
-// cat %t | FileCheck %S/hps_2_test.filecheck
+// RUN: cat %t | FileCheck %S/hps_2_test.filecheck
 
 // RUN: ${TEST_RUNNER_CMD} %S/hps_2_bytecode_static 2>&1 | tee %t
 // RUN: cat %t | FileCheck %S/hps_2_test.filecheck