If you wrote it before you started your employment, it is your intellectual property.
However, you should not just arbitrarily include intellectual property that the company doesn't own in a project you are building for the company, without their knowledge and agreement.
Often it's expected that you will make use of open source code in the course of building the company's project, but that is explicitly licensed to the company (via being published with an open invitation for anybody to accept the open source license it's published with), and if the company wants you to use open source material it is presumably happy to comply with those license terms. (You also should not include open source material without knowing the company is happy to be bound by the open source licenses for this project; generally it's clear if that's the case because there is already lots of open source code included in the project codebase, but it would never hurt to ask what the policy is explicitly)
Unpublished code you just happen to have access to should never be included in the company's projects. Without a license the company may be on the hook for copyright infringement, and even worse could find itself trapped unable to continue developing its own products because it is unable to make further derivative works of the code it does not own and has no license to use!
Code you just happen to have access to because you wrote it is only slightly different, in that you would be able to enter into a license agreement with the company to ensure the above situation does not happen. But the company will want to have an explicit written license agreement, so you absolutely should not include your own code without talking to your boss. And they are unlikely to accept any license less permissive than an open source license (so you won't be able to keep your code private to just yourself and the company; they will need extensive rights to modify and distribute it after you have left the company).
If you do include this code that is owned by you, rather than by the company, you may also be inviting personal trouble. If there is no evidence of the fact that you wrote it prior to your work for this company they may believe you are stealing their property if you later use it, and then engage legal proceedings against you. Strictly speaking this should come out in your favour, but if there's little documented evidence of exactly the circumstances in which the code was first created, then you can't rely on a court to rule that you should be the owner, even if that is the truth. So you should want an explicit written license agreement before using this code int he company project too, so that you later have proof that the company acknowledged your prior ownership.
But really, the company does not (or at least should not) want to get into that situation of disputed ownership in the first place. They would much rather you only included code that is either created during the course of your employment (so they own it completely) or is clearly licensed to the company (such as widely published open source code). Code you own but haven't published as open source prior to starting with the company, unless it is quite substantial, is probably just not worth the hassle for them of getting it properly licensed. Most likely paying developers to reinvent that wheel is cheaper than paying lawyers to make sure there are no legal issues.