+2019-05-30  Jim Wilson  <jimw@sifive.com>
+
+       * config/tc-riscv.c (riscv_ip) <'u'>: Move O_constant check inside if
+       statement.  Delete O_symbol and O_constant check after if statement.
+       * testsuite/gas/riscv/auipc-parsing.s: Test lui with missing %hi.
+       * testsuite/gas/riscv/auipc-parsing.l: Update.
+
 2019-05-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR gas/24625
 
 
            case 'u':           /* Upper 20 bits.  */
              p = percent_op_utype;
-             if (!my_getSmallExpression (imm_expr, imm_reloc, s, p)
-                 && imm_expr->X_op == O_constant)
+             if (!my_getSmallExpression (imm_expr, imm_reloc, s, p))
                {
+                 if (imm_expr->X_op != O_constant)
+                   break;
+
                  if (imm_expr->X_add_number < 0
                      || imm_expr->X_add_number >= (signed)RISCV_BIGIMM_REACH)
                    as_bad (_("lui expression not in range 0..1048575"));
                  *imm_reloc = BFD_RELOC_RISCV_HI20;
                  imm_expr->X_add_number <<= RISCV_IMM_BITS;
                }
-             /* The 'u' format specifier must be a symbol or a constant.  */
-             if (imm_expr->X_op != O_symbol && imm_expr->X_op != O_constant)
-               break;
              s = expr_end;
              continue;
 
 
 .*: Assembler messages:
 .*: Error: illegal operands `auipc x8,x9'
 .*: Error: illegal operands `lui x10,x11'
+.*: Error: illegal operands `auipc x12,symbol'
+.*: Error: illegal operands `lui x13,symbol'