@@ -73,6 +73,10 @@ private static String generate(CompileFramework comp) {
7373 .flatMap (MinMaxOp ::generate )
7474 .forEach (testTemplateTokens ::add );
7575
76+ // Note that for floating point Min/Max these cases below don't hold
77+ generate (MinMaxOp .MIN_I , MinMaxOp .MAX_I ).forEach (testTemplateTokens ::add );
78+ generate (MinMaxOp .MIN_L , MinMaxOp .MAX_L ).forEach (testTemplateTokens ::add );
79+
7680 Stream .of (Fp16MinMaxOp .values ())
7781 .flatMap (Fp16MinMaxOp ::generate )
7882 .forEach (testTemplateTokens ::add );
@@ -89,6 +93,38 @@ private static String generate(CompileFramework comp) {
8993 testTemplateTokens );
9094 }
9195
96+ static Stream <TemplateToken > generate (MinMaxOp op1 , MinMaxOp op2 ) {
97+ return Stream .of (template ("a" , "b" , op1 , op2 ), template ("b" , "a" , op1 , op2 ),
98+ template ("a" , "b" , op2 , op1 ), template ("b" , "a" , op2 , op1 )).
99+ map (Template .ZeroArgs ::asToken );
100+ }
101+
102+ static Template .ZeroArgs template (String arg1 , String arg2 , MinMaxOp op1 , MinMaxOp op2 ) {
103+ return Template .make (() -> scope (
104+ let ("boxedTypeName" , op1 .type .boxedTypeName ()),
105+ let ("op1" , op1 .name ()),
106+ let ("op2" , op2 .name ()),
107+ let ("type" , op1 .type .name ()),
108+ let ("fn1" , op1 .functionName ),
109+ let ("fn2" , op2 .functionName ),
110+ let ("arg1" , arg1 ),
111+ let ("arg2" , arg2 ),
112+ """
113+ @Test
114+ @IR(counts = {IRNode.#op1, "= 0", IRNode.#op2, "= 0"},
115+ phase = CompilePhase.BEFORE_MACRO_EXPANSION)
116+ @Arguments(values = {Argument.NUMBER_42, Argument.NUMBER_42})
117+ public #type $test(#type #arg1, #type #arg2) {
118+ int i;
119+ for (i = -10; i < 1; i++) {
120+ }
121+ #type c = a * i;
122+ return #boxedTypeName.#fn1(a, #boxedTypeName.#fn2(b, c));
123+ }
124+ """
125+ ));
126+ }
127+
92128 enum MinMaxOp {
93129 MIN_D ("min" , CodeGenerationDataNameType .doubles ()),
94130 MAX_D ("max" , CodeGenerationDataNameType .doubles ()),
0 commit comments