diff --git a/gcc/config/h8300/testcompare.md b/gcc/config/h8300/testcompare.md
index 2e4cb5afee746f8458b5c67931538913fb6230db..118db145a8aa67b55e4acd08adf6d6ed95168869 100644
--- a/gcc/config/h8300/testcompare.md
+++ b/gcc/config/h8300/testcompare.md
@@ -9,7 +9,7 @@
 				  (match_operand 1 "const_int_operand" "n,n,n"))
 		 (const_int 0)))
    (clobber (match_scratch:QI 2 "=X,X,&r"))]
-  ""
+  "!CONSTANT_P (operands[0])"
   "@
    btst\\t%Z1,%Y0
    btst\\t%Z1,%Y0
@@ -82,7 +82,7 @@
 					  (const_int 7)))
 		 (const_int 0)))
    (clobber (match_scratch:QI 2 "=X,X,&r"))]
-  ""
+  "!CONSTANT_P (operands[0])"
   "@
    btst\\t%w1,%X0
    btst\\t%w1,%X0